本帖最后由 sujx 于 2015-8-31 02:45 编辑
1、请尝试用while循环打印下面的图形
[mw_shl_code=c,true]#include <stdio.h>
#include <stdlib.h>
int main()
{
int a,b;
a=1;
while(a<=5)
{
b=1;
while (b<=a)
{
printf("%-1d ",a);
b++;
}
printf("\n");
a++;
}
system("pause");
return 0;
}
[/mw_shl_code]
2、请尝试用while循环打印下面的图形
[mw_shl_code=c,true]#include <stdio.h>
#include <stdlib.h>
int main()
{
int a,b,s;
a=1;
s=1;
while(a<=5)
{
b=1;
while (b<=a)
{
printf("%-1d ",s);
s++;
b++;
}
printf("\n");
a++;
}
system("pause");
return 0;
}[/mw_shl_code]
|