C++ 编程 while 循环Create a while loop. Before the loop, ask the user to enter an integer. Go through the loop as many times as the number entered. Keep count of the number of times you’ve gone through the loop and print this number in the l

来源:学生作业学帮网 编辑:学帮网 时间:2024/05/16 14:50:21

C++ 编程 while 循环
Create a while loop. Before the loop, ask the user to enter an integer. Go through the loop as many times as the number entered. Keep count of the number of times you’ve gone through the loop and print this number in the loop.

int num;
printf("Please enter a int : ");
scanf("%d",&num);
while(num>0)
{
printf("%d\n",num);
num--;
}