#include <stdio.h>
int main(int argc, const char * argv[]) {
int hang = 4;//行数,可以是任意正整数 for (int wai = 0; wai < hang; wai++) {//外层循环 for (int nei1 = wai; nei1 < hang - 1; nei1++) {//内层循环1 printf(" ");//打印空格 } for (int nei2 = 0; nei2 <= wai * 2; nei2++) {//内层循环2 printf("*");//打印星号 } printf("\n"); }
return 0; }
|