a program in c programming language that print the pattern of a pyramid using a for loop.

Full Pyramid

     * 
    * * 
   * * * 
  * * * * 
 * * * * * 
* * * * * *

							


c program tor print full pyramid.

/*
* C Program to Print Full Pyramid
*/
#include<stdio.h>
#include<stdlib.h>
int main()
{
 int rows;
 int spaces;
 int column;
  printf("\nEnter the number of rows :\n");
  scanf("%d",&rows);
 //showing full pyramid
 printf("*****--Full Pyramid--******\n");
 for(int i=0;i< rows; i++)
 {
  for(int l=0;l< rows-1-i;l++)
  {
   printf(" ");
  }
  for(int j=0; j<=i;j++)
  {
    printf("%c ",'*');
  }
 printf("\n");
 }
 printf("\n");
 return 0;
}


Explanation
1. Accept the number of rows as input and store it in variable rows.
2. Run a loop that iterates over the number of rows, and we see that the number of * symbols increases by one as we progress through the pattern.
3. The number of symbols * in each line is equal to the line number. As a result, we have to print as many lines as stars.
4. We also need to print spacing to get equality, so we print the number of rows and the line spacing.
5. But this pattern has a problem. The nested loop contains two inner loops i and j.
where i will be responsible for printing the white space and j will print the star pattern.


Previous :-->> 8.Write a program in c to check if a given number is an Armstrong number or not using a while loop.
 -->> NEXT: 10.Write a program in c to check if a given number is a perfect square or not using a while loop or do while loop.
-->>ALL Loops Assignments in c