首页 > 编程语言 > 详细

C语言课后习题

时间:2019-05-18 00:16:25      阅读:124      评论:0      收藏:0      [点我收藏+]

/*最大公约数求解*/
#include "stdafx.h"
#include <stdio.h>
int main()
{
 int max(int,int);
 int a,b;
 printf("Please input your numbers\n");
 scanf("%d,%d\n",&a,&b);
 printf("最大公约数为:%d\n",max(a,b));
 return 0;
}
int max(int,int)
{
 int a,b,r;
 int t;
 if(b>a)
 {
  b=t;
  t=b;
  b=a;
 }
 while(r=a/b!=0)
 { 
  a=b;
  b=r;
 return b;
 }
}

C语言课后习题

原文:https://www.cnblogs.com/pquan/p/10884199.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!