c++求最大公约数

void gongyueshu(){
int a,b,r,n;

scanf("%d,%d", &a, &b);
if(a<b){
n=a;
a=b;
b=n;
}
r=a%b;
while(r!=0){
a=b;
b=r;
r=a%b;
}
printf("%d",b);
}

 

#include<stdio.h>
int main() {
void gongyueshu();
gongyueshu();

}

posted @ 2021-03-14 12:11  陈扬天  阅读(163)  评论(0编辑  收藏  举报