这个c语言程序运行过程是什么?
#include <stdio.h>
#include <stdlib.h>
int main()
{
int a,b,c;
printf("请输入行数c ",c);
system("color 5e");
scanf("%d",&c);
system("cls");
a=1;
while(a<=c)
{
b=1;
while(b<=a)
{
printf("%d",b);
b=b+1;
}
printf("%d",b);
a=a+1;
printf(" ");
}
system("pause");
return 0;
}
为了看清楚运行过程,去除了控制屏幕的两个语句。输入行数为4时,运行结果如下
对照运行结果,输入行数=4,再看程序,就知道运行过程了。
码农的世界我不懂,
热门标签: