遞回練習公因數(3個數)_
#include<stdio.h>
#include<stdlib.h>
int gcd(int a,int b)
{ int d
if(a%b==0)
return b;
else
return gcd(b,a%b);
}
int main(void)
{
int a,b,c;
printf("Given three number:\n");
scanf("%d",&a);
scanf("%d",&b);
scanf("%d",&c);
printf("We get the result:\n");
printf("gcd(%d,%d,%d)=%d\n",a,b,c,gcd(gcd(a,b),c));
system("pause");
return 0;
}
Today's Visitors: 0 Total Visitors: 10
歷史上的今天:

Sealed (Aug 24)
Only friends can post a comment, Login first