My desired output is the following
The underscores represent space. This is what I've done so far... please help because I'm really confused.Code:__* _*** *****
With the above this is my output::Code:#include <stdio.h> #include <conio.h> void main() { int value1, space, star; printf("\n\n"); for(value1=5; value1>=1; value1=value1-2) { for(space=1; space==value1/2; space++) { printf(" "); } for(star=0; star < 6-value1; star++) { printf("*"); } printf("\n"); } printf("%d %d %d", value1, space, star); getch(); }
*
_***_
*****
Except for the first star it's all good. And can someone please quickly explain how for loops execute all of their statements/conditions if another for loop is enveloped? I'm really confused and can't concentrate on anything... I'm just typing something, compiling and doing it over and over. For example... I have no idea why I put "star < 6-value1;" in the third for loop. I know that it means that star is less than 6 subtracted by value 1... but if value1 starts out as 5 then should star always be a negative? Please help!! TIA.