题解 | #反斜线形图案#
反斜线形图案
http://www.nowcoder.com/practice/7b066963c4eb4d188becd18c37dfe22d
/*先复制粘贴过来看下空格格式
*
*
*
*
*/
#include<stdio.h>
int main(void)
{
int n;
while((scanf("%d",&n))!=EOF)
{
for(int i=1;i<=n;i++)
{
for(int j=1;j<=n;j++)
{
if(i==j)//刚好斜线的时候打印符合
printf("*");
else//其余的打印空格
printf(" ");
}
printf("\n");
}
}
return 0;
}