Home > Back-end >  [question] triangles * for loop to do
[question] triangles * for loop to do

Time:09-30

I know I shouldn't play made a mistake is int * because I want to take a *
I know that is very complex with ten rows *
But I want to use a for loop
Behind this time is short, because I also pritf to enter *
It's a pity that I don't know how to take a *
The template below
*
* *
* * *
* * * *
* * * * *
* * * * * *

CodePudding user response:

For your reference
 
#include

Int main ()
{
Int I, j, n=0;
Printf (" input lines: \ n ");
The scanf (" % d ", & amp; N);
for (i=0; I{
For (j=0; JPrintf (" ");
For (j=0; JPrintf (" * ");
printf("\n");
}

getchar();
return 0;
}

CodePudding user response:

Diamond is this come round not tired, I was also around not to come over, play more, make sure you want to make a way, such as the diamond is playing two triangles to piece together, triangle in sure you want to play a few layer, this is the outer loop, inner loop check Spaces and the * and the layer number and print a thing with a loop, so space a loop * a cycle
  • Related