【发布时间】:2015-10-14 12:38:09
【问题描述】:
让用户输入一个介于 1 到 100 之间的随机数。然后询问他/她想要在他/她输入的第一个数字之前显示多少个数字。
如果用户输入 9 并想要 3 个在 9 之前的数字,您的程序应该显示:
6 7 8 9
我写不完。
#include <stdio.h>
#include <stdlib.h>
int main()
{
int endnum, pre;
printf("Enter a random number between 1 and 100: ");
scanf("%d", &endnum);
printf("how many numbers he wants to display that precedes first number you entered: ");
scanf("%d", &pre);
num = endnum - pre;
printf (%d, num+1)
num = num + 1
while (num <= endnum)
return 0;
}
【问题讨论】:
标签: c