#include<stdio.h>
int gcf(int i,int j);
void main()
{
int a,b;
printf("Please input two nature numbers:\n");
printf("\n");
scanf("%d%d",&a,&b);
printf("\n");
if (a>=b)
{
printf("The GCF of %d and %d is %d\n",a,b,gcf(a,b));
}
else
{
printf("The GCF of %d and %d is %d\n",a,b,gcf(b,a));
}
printf("\n");
}
int gcf(int i,int j)
{
int k;
for(;k!=0;)
{
k=i%j;;
i=j;
j=k;
}
return i;
}
同上篇
--
好無聊
--
※ 發信站: 批踢踢實業坊(ptt.twbbs.org)
◆ From: h178.s87.ts.hin