wpzy

导航

 
 1 #include <stdio.h>
 2 #include <stdlib.h>
 3 
 4 /* run this program using the console pauser or add your own getch, system("pause") or input loop */
 5 
 6 int main(int argc, char *argv[]) {
 7     
 8     
 9     int num;
10     scanf("%d",&num);
11     
12     int i;
13     for(i=1;i<=num;i++){
14         
15         int j=1;
16         while(j<=(num-i)){
17             
18             printf(" ");
19             j++;
20         
21         }
22         
23         int k=1;
24         while(k<=(2*i-1)){
25             printf("*");
26             k++;
27         }
28         
29         
30 
31         
32         int m=1;
33         while(m<=(num-i)){
34             
35             printf(" ");
36             m++;
37         
38         }
39         
40         
41     printf("\n");
42         
43         
44         
45         
46         
47         
48     }
49     
50     
51     
52     return 0;
53 }

 

posted on 2015-11-20 14:41  wpzy  阅读(157)  评论(0编辑  收藏  举报