4.1 最大公约数

#include<stdio.h>
int main()
{
int m,n, temp,i,k;
printf( "Input m & n:");scanf("号d%d", &m, &n);if(m<n)
{/★交换m和n的值*/
temp-m;
m=n;
n=temp;
for (i=1;i<n;i++)
if(m%i==o&&n%i-=0)
k=i;
/*将当前情况下的最大公约数存储在k中*/
printf ("The GCD of %d and %d is: %d\n",m, n, k);
}

 

posted @ 2023-05-25 21:38  痛苦代码源  阅读(11)  评论(0)    收藏  举报