我的代码输出中有多余的空格(缩进)。输出应为:
Enter your number: Enter your number: Enter your number:
但事实并非如此,是CLion 2019.1.2输出:
Enter your number: Enter your number: Enter your number:
#include <stdio.h>
int main (void){
int x =0;
printf("Enter your number: ");
scanf("%d", &x);
printf("Enter your number: ");
scanf("%d", &x);
printf("Enter your number: ");
scanf("%d", &x);
printf("Enter your number: ");
scanf("%d", &x);
printf("Enter your number: ");
scanf("%d", &x);
printf("Enter your number: ");
scanf("%d", &x);
return 0;
}
答案 0 :(得分:-2)
每个printf语句在':'之后和“之前的末尾都有一个空格,这会导致下一个printf语句在打印到控制台之前具有一个空格
更改:
printf("Enter your number: ");
收件人:
printf("Enter your number:");