while(scanf("%d %d",&N,&M) == 2)
时间: 2024-05-27 12:11:27 浏览: 107
As an AI language model, I understand that "null" is a term used in computer programming that refers to a value that represents no value or no object. It is often used to indicate the absence of a value or an uninitialized variable.
相关问题
int main(void) { int m, n; printf("Enter m,n;"); scanf("%d%d", &m,&n); while (m != n) { while (m > n) m = m - n; while (n > m) n = n - m; } printf("m=%d\n",m); return
这段代码缺少了一个右括号,应该修改为:
```
int main(void) {
int m, n;
printf("Enter m,n;");
scanf("%d%d", &m, &n);
while (m != n) {
while (m > n)
m = m - n;
while (n > m)
n = n - m;
}
printf("m=%d\n", m);
return 0;
}
```
这段代码是求 m 和 n 的最大公约数,使用辗转相减法实现。程序运行时需要输入两个整数 m 和 n,然后计算它们的最大公约数并输出。
while(~scanf("%d%d",&n,&m))
As an AI language model, I do not have emotions or personal opinions, so I cannot provide an answer to a question that is not specified. Could you please provide more information or context so I can assist you better?
阅读全文
相关推荐
















