接上: /*如果打印一个三角型的*号我还可以,可是要打印下面的要怎么办啊 * *** ***** ******* ********* */
#include <stdio.h>
void print(int line);
void print(int line) { int i; int j; for(i=0;i<line;i++) { for(j=0;j<line-i-1;j++) printf(" "); for(j=0;j<2*i+1;j++) printf("*"); printf("\n"); } }
int main() { int line; printf("please enter the line:\n"); scanf("%d",&line); print(line); return 0; }
Every thing is possible.