早教吧 育儿知识 作业答案 考试题库 百科 知识分享

在该程序单步调试过程中,如果要观察表达式n%2的结果,该如何操作#include"stdio.h"voidmain(){intn;while(1){printf("Enteranumber:");scanf("%d",&n);if(n%2==1){printf("Isaid\n");continue;}}}

题目详情
在该程序单步调试过程中,如果要观察表达式n%2的结果,该如何操作
#include "stdio.h"
void main()
{
int n;
while(1)
{
printf("Enter a number:");
scanf("%d",&n);
if(n%2 == 1)
{
printf("I said\n");
continue;
}
}
}
▼优质解答
答案和解析
在if 前 加一句
int s = n%2