题解 | #带空格直角三角形图案#
带空格直角三角形图案
https://www.nowcoder.com/practice/192d1039c3d44155bb868073f5482670
#include <stdio.h> int main() { int n = 0; int i = 0, j = 0; int k = 0; while (scanf("%d", &n) != EOF) { for (i = 1; i <= n; i++) { for (k = n; k > i; k--) { //控制空格 printf(" "); } for (j = 1; j <= i; j++) { //打印*号 printf("* "); } printf("\n"); } } return 0; }