Another simple program using for loop
Code:
#include <stdio.h>
#include <stdlib.h>
int main()
{
int space, row, stars, number_of_stars;
printf("How many stars you want?");
scanf(" %d", &number_of_stars);
for (row = 1; row <= number_of_stars; row++) {
for (space = 1; space <= number_of_stars; space++) {
printf(" ");
}
for (stars = 1; stars <= row; stars++) {
printf(" *");
}
printf("\n");
number_of_stars--;
}
return 0;
}
The output is a simple pyramid but it skips one row/line. I want the user to type how many rows you want for example I type '12'. It only shows half of it.