题解 | #翻转金字塔图案#
翻转金字塔图案
http://www.nowcoder.com/practice/c4775776e4464537bfb6a5ba37c596c6
#include<stdio.h>
int main() {
int n;
while (scanf("%d", &n) != EOF) {
int m = 0;
for (int i = n; i > 0; i--) {
m++;
for (int j = 1; j < m; j++) {
printf(" ");
}
for (int k = 0; k < i; k++) {
printf("* ");
}
printf("\n");
}
}
return 0;
}
int main() {
int n;
while (scanf("%d", &n) != EOF) {
int m = 0;
for (int i = n; i > 0; i--) {
m++;
for (int j = 1; j < m; j++) {
printf(" ");
}
for (int k = 0; k < i; k++) {
printf("* ");
}
printf("\n");
}
}
return 0;
}