printf ("How many lines stars (*) should be printed?:");
scanf ("%d",&cx);
for (i=lrf<=x;i++)
I
for (j=l;j<=i;j++)
I
printf (" * ");
I
printf ("\n");
I
I
output:
How many lines stars (*) should be printed ? : 5
* *
* * *
♦ * * *
* * * * »
ExplanationHere in the above example the two forloops are used for displaying as per the
format shown in the output. Variables x, i& j are used according to the requirement. On execution
of inner loop star/stars are displayed. To display them in different lines second printf () statement
is used.
6.41 Write a program to ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month, and much more.