-
Notifications
You must be signed in to change notification settings - Fork 0
/
Chapter4-Q16-c.c
37 lines (31 loc) · 972 Bytes
/
Chapter4-Q16-c.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/*
Author is : Ibrahim Halil GEZER
4.16 (Triangle Printing Program) Write a program that prints the following patterns separately,
one below the other. Use for loops to generate the patterns. All asterisks (*) should be printed by a
single printf statement of the form printf( "*" ); (this causes the asterisks to print side by side).
[Hint: The last two patterns require that each line begin with an appropriate number of blanks.]
(A) (B) (C) (D)
* ********** ********** *
** ********* ********* **
*** ******** ******** ***
**** ******* ******* ****
***** ****** ****** *****
****** ***** ***** ******
******* **** **** *******
******** *** *** ********
********* ** ** *********
********** * * **********
*/
#include<stdio.h>
int main (void)
{
int i, j ;
int number = 10 ;
for (i=1; i<=number; i++) {
for (j=1; j<=number-i; j++) {
printf ( "*" );
}
printf ("\n");
}
return 0 ;
} // end function main