题解 | #带空格直角三角形图案#
带空格直角三角形图案
http://www.nowcoder.com/practice/192d1039c3d44155bb868073f5482670
the str in line 1 almost drives me crazy.fortunately,adding 'else'in functin has solve the problem #include<stdio.h> int main(){ int x; while(scanf("%d",&x)!=EOF){ for(int i=1;i<=x;i++){ for(int j=1;j<=x;j++){ if(j==x) printf("\n"); else if(x-j<i&&x-j>0) printf(" "); else printf(" "); } } } }