标题:求最大公约数的程序 谁能告诉我为什么我编译以后结果是错的呢
取消只看楼主
huazi111
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2011-9-30
结帖率:0
已结贴  问题点数:5 回复次数:0 
求最大公约数的程序 谁能告诉我为什么我编译以后结果是错的呢
#include <stdio.h>

int main()
{
  int gcd(int a,int b);
  int a,b,c;
  
  printf("please input two numbers:");
  scanf("%d,%d",&a,&b);
  
  c=gcd(a,b);
  
  printf("The greatest common divisor is: %d",c);
  
  system("PAUSE");//结束
  return 0;
}
int gcd(int a,int b)
{
    int c,d;
    if(a<b)
    {
    c=a;
    a=b;
    b=c;
   }
   while((d=a%b)!=0)
   {
       a=b;
       b=d;
   }
   return b;
}
搜索更多相关主题的帖子: include numbers please system return 
2011-11-03 21:25



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-354210-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.348233 second(s), 8 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved