S
sathyashrayan
Dear group,
I tryied to impliment a simple GCD algo, just print the common
divisors between two numbers. The simple task I was trying with various
method and till now I could not able to implement. Below is a one try but
various attempts looks nonsensial.
I might be weasting you peoples precious time but, since I an a
self thought lerner i put this in the group for help, thanks.
int main(void)
{
int first, second,i,j, first_rem, first_quot, second_rem,
second_quot, common_div=0;
scanf("%d%d",&i,&j);
do{
for(i = 2 ; i< first ; i++)
{
first_rem = i % first;
first_quot = i / first;
}
for(j = 2 ; j < second ; j++)
{
second_rem = i % second;
second_quot = i / second;
}
if(first_quot == second_quot)
{
common_div = first_quot;
printf("common divisers = %d\n",common_div);
}
}while(first_rem != 0 && second_rem != 0);
return 0;
}
I tryied to impliment a simple GCD algo, just print the common
divisors between two numbers. The simple task I was trying with various
method and till now I could not able to implement. Below is a one try but
various attempts looks nonsensial.
I might be weasting you peoples precious time but, since I an a
self thought lerner i put this in the group for help, thanks.
int main(void)
{
int first, second,i,j, first_rem, first_quot, second_rem,
second_quot, common_div=0;
scanf("%d%d",&i,&j);
do{
for(i = 2 ; i< first ; i++)
{
first_rem = i % first;
first_quot = i / first;
}
for(j = 2 ; j < second ; j++)
{
second_rem = i % second;
second_quot = i / second;
}
if(first_quot == second_quot)
{
common_div = first_quot;
printf("common divisers = %d\n",common_div);
}
}while(first_rem != 0 && second_rem != 0);
return 0;
}