Go4Expert

Go4Expert (http://www.go4expert.com/)
-   C (http://www.go4expert.com/articles/c-tutorials/)
-   -   Finding LCM & GCD in C (http://www.go4expert.com/articles/finding-lcm-gcd-c-t457/)

shabbir 17Nov2006 18:24

Re: Finding LCM & GCD in C
 
They will appear once on a page. You will see it on the seventh post of the thread.

insamd 18Dec2006 10:14

Re: Finding LCM & GCD in C
 
hey guys,

Was just interested if with the GCD function if its possible to find the GCD of 3 different numbers rather than just 2? Would be interested to see it.

Thanks

BlasterBlang 27Dec2006 13:13

Re: Finding LCM & GCD in C
 
helloo

sharma_atul13 17Jul2007 13:59

Re: Finding LCM & GCD in C
 
liked the way to do manipulations done in LCM and GCD programs

clocking 22Jul2007 15:03

Re: Finding LCM & GCD in C
 
hi everyone!
I have code following:
You see and shift it
Code:

struct ths
{
  char ht[24];
  char tt[21];
  int sobd;
  float m,l,;
};
class ts
{
  private:
    int sots;
    ths *ts;
  public:
  ts()
  {
    sots = 0 ;
    ts = NULL;
  }
void swap();
};

void ts::swap()
{
  int n = sots;
  for ( int i = 1; i < n; ++i)
  for (int j = i + 1; j <= n; ++j)
  if (ts[i].m < ts[j].m)
  {
    ths tmp = ts[i];
    ts[i] = ts[j];
    ts[j] = tg;
  }
}

// thanks.

shabbir 22Jul2007 20:00

Re: Finding LCM & GCD in C
 
Offtopic comment:
Use code tag ([ code][/code ]) when you have code snippets in the post.

clocking 23Jul2007 07:10

Re: Finding LCM & GCD in C
 
Quote:

Originally Posted by shabbir
Offtopic comment:
Use code tag ([ code][/code ]) when you have code snippets in the post.

:) Thanks so much, my friend!
this is code in C++, how do you see ?
ofcourse, Class in C++ is difficult.
What way do you help me to express easy?

clocking 23Jul2007 07:15

Re: Finding LCM & GCD in C
 
hi everybody!
Follow you, Can we do in swap 2 structs easier?
Code:

tmp = ts[i] ;
ts[i] = ts[j];
ts[j] = tmp;

thanks.

shabbir 23Jul2007 08:28

Re: Finding LCM & GCD in C
 
You can swap the struct if they are addresses and not the objects can be done in that way unless they have the overloaded = operator.

clocking 23Jul2007 12:49

Re: Finding LCM & GCD in C
 
thank, but can we do easier for it ?
not tmp.


All times are GMT +5.5. The time now is 02:29.