循环图形问题

题目:输入图形的每行有n个星号,高 n ,输出对应的图形 .
来源:123.206.77.74
输入:整数n例如 5
输出:每行由5个*组成的,高为5的平行四边形
样例输入:5
样例输出:





*****   

#include <stdio.h>
#include <stdlib.h>

/* run this program using the console pauser or add your own getch, system(“pause”) or input loop */

int main(int argc, char argv[])
{
int i,n,j,k;
scanf("%d",&n);
for (i=1;i<=n;i++)
{
for (j=1;j<=i-1;j++)
printf(" “);
for (k=1;k<=n;k++)
printf(”
");
printf("\n");
}
return 0;
}
注:循环的嵌套,\0,*和\n的切换
发布人:吴宜融

猜你喜欢

转载自blog.csdn.net/weixin_43805821/article/details/84726390