#include 02 | #include |
03 |
04 |
05 | int main() |
06 | { |
07 | int i, j, k, rows; |
08 | printf("Specify the number of rows (between 1-19) in the dimond: "); |
09 | scanf ("%d",&rows); |
10 | printf("\n"); |
11 | for(i=1; i<=rows; i++) |
12 | { |
13 | for(j=1; j<=rows-i; j++) |
14 | printf("%c",' '); |
15 | for(k=1; k<=2*i-1; k++) |
16 | printf("%c",'*'); |
17 | printf("\n"); |
18 | } |
19 | int l,m,n; |
20 | for (n = rows-1; n > 0;n--) |
21 | { |
22 | for (l = 1; l <= rows- n; l++) |
23 | printf("%c",' '); |
24 | for (m = 1; m<= 2 * n- 1; m++) |
25 | printf("%c",'*'); |
26 | printf("\n"); |
27 | } |
28 | getch(); |
29 | } | | | The output should be | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
No comments:
Post a Comment