#include<stdio.h> #include<stdlib.h> intmain() { int line = 0; int i = 0; scanf("%d",&line); for(i=0;i<line;i++)//Print the upper part { int j = 0; for(j=0;j<line-1-i;j++)//Print spaces { printf(" "); } for(j=0;j<2*i+1;j++)//打印* { printf("*"); } printf("\n"); } for(i=0;i<line-1;i++)//Print the second half { int j = 0; for(j = 0;j<=i;j++)//print spaces { printf(" "); } for(j = 0;j<2*(line-1-i)-1;j++)//打印* { printf("*"); } printf("\n"); } system("pause"); return 0; }
operation result