求M和N最大公约数?#include<stdio.h>void main(){ &nbs
来源:学生作业帮 编辑:大师作文网作业帮 分类:综合作业 时间:2024/11/12 05:15:57
求M和N最大公约数?
#include<stdio.h>
void main()
{
int m, n, r;
scanf("&d,%d",&m,&n);
do
{
m%n==r;
if(r==0);
printf("big is %d\n",n);
else
{
n==r;
m==n;
m%n==r;
}
}while(r==0);
if(r==0);
printf("big is %d\n",n);
有十个警告还有一个错误,求指导
#include<stdio.h>
void main()
{
int m, n, r;
scanf("&d,%d",&m,&n);
do
{
m%n==r;
if(r==0);
printf("big is %d\n",n);
else
{
n==r;
m==n;
m%n==r;
}
}while(r==0);
if(r==0);
printf("big is %d\n",n);
有十个警告还有一个错误,求指导
#include
int main()
{
int m, n, r;
scanf("%d%d",&m,&n);
printf("n=%d\n",n);
do
{
r=m%n;
if(r==0)
printf("big is %d\n",n);
else
{
n=r;
m=n;
}
}while(r!=0);
if(r==0);
printf("big is %d\n",n);
}
LZ基础没打好,好好看看书中的例子,
输入的格式,赋值的格式,条件判断等等
都需要好好看看
int main()
{
int m, n, r;
scanf("%d%d",&m,&n);
printf("n=%d\n",n);
do
{
r=m%n;
if(r==0)
printf("big is %d\n",n);
else
{
n=r;
m=n;
}
}while(r!=0);
if(r==0);
printf("big is %d\n",n);
}
LZ基础没打好,好好看看书中的例子,
输入的格式,赋值的格式,条件判断等等
都需要好好看看