:);) please !!!

// if u is greater than v then the greatest common divisor of u and v 
// is the same as the greatest common divisor of v and u - v.
// This observation leads to the following implementation in C:
#include <stdio.h>
int gcd(int u, int v)
{
	int t;
	while (u>0)
	{
		if(u<v)
		{t=u;u=v;v=t;}
		u=u-v;
		printf("%d -- %d \n",u,v);
	}
	return v;
}

main()
{
	int x,y;
	while(scanf("%d %d", &x, &y) != EOF)
		if(x>0 && y>0)
			printf("%d %d %d \n",x,y,gcd(x,y));
}

//above is example .. use two integer  i need three integer to same result .. help me plz (will not EZ) =)

In gcd() you return v, but that's the value you passed into the function unchanged.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.