{ // do for four lines
for(j=3;j>=0;j--)
{ // print out decreasing number of spaces for each line
// print out j spaces
for(k=1;k<8;k+2)
{ // print out odd number of stars
print out k stars
} // end of stars
} // end of spaces
print out end of line designator
} // end of row/line
(indent lines as the answer form ignores whitespace)
You want to be a programmer? Programming is about solving problems. This is quite a simple problem, involving nested for loops. You're not expected to get it right first time, so write the code, run it, see what output you get. If it's not right, change what needs changing and try again. It may take several goes before it works properly. But then it will be YOUR work. Good luck! You can do this.
for(i=1;i<5;i++)
{ // do for four lines
for(j=3;j>=0;j--)
{ // print out decreasing number of spaces for each line
// print out j spaces
for(k=1;k<8;k+2)
{ // print out odd number of stars
print out k stars
} // end of stars
} // end of spaces
print out end of line designator
} // end of row/line
My output should be this :
*
***
*****
*******
There are 3 spaces before the first star, two before the second and so.we have to use the FOR loop and there has to be 3 loops(one for the row ,one for the stars and one for the spaces) Please tell me the program for this