高手,帮忙,这哪有错了?谢谢了(求俩数的最大公约数)
# include(stdio.h)void main()
{ int gy(int m,int n);
int a,b,c;
scanf("%d,%d",&a,&b);
c=gy(a,b);
printf("最大公约数是:%d\n");}
int gy(int m,int n)
{ intr;
r=m%n;
while(r!=0)
{m=n;n=r;r=m%n}
return(n);}
#include<stdio.h> int main() { int num1 = 0,num2 = 0, common = 0; puts("Input 2 integers:"); scanf("%d%d",&num1,&num2); if(num1 > num2) { int temp = num1; num1 = num2; num2 = temp; } int i ; for(i = 1;i <= num1;i++) { if(num1 % i == 0 && num2 % i == 0) common = i; } printf("%d和%d的最大公约数是%d\n",num1,num2,common); return 0; }