题解 | #金字塔图案#
金字塔图案
https://www.nowcoder.com/practice/d84e8339f9444bb6b29bd3f227c8e538
#include <stdio.h> int main() { long int n = 0; while (~scanf("%ld", &n)) { for (long int i = 0; i < n; i++) { // 打印空格 for (long int j = 0; j < n - i - 1; j++) { printf(" "); } // 打印字符 for (long int j = 0; j <= i; j++) { printf("* "); } printf("\n"); } } return 0; }