USING C LANGUAGE PRINT THE PYRAMID
#include<stdio.h>
#include<conio.h>
void main()
{
int noofrows,rows,col1,col2,noofcols;
clrscr();
printf ("Enter the number: ");
scanf ("%d",&noofrows);
noofcols=noofrows-1;
for(rows=1;rows<=noofrows;rows++)
{
for(col1=1;col1<=noofcols;col1++)
{
printf(" ");
}
noofcols--;
for(col2=1;col2<=rows;col2++)
{
printf (" *");
}
printf ("\n");
}
getch ();
}
--------------------------------------------------------------------------------------------------------------
Output:
Enter the number:5
*
* *
* * *
* * * *
* * * * *
Print the pyramid using c language
Reviewed by Amit Waghmare
on
December 10, 2018
Rating:
No comments: