Sunday 22 July 2012

how to print the pyramid in c language

/* To print Pyramid Pattern shown below
1
2 2
3 3 3
4 4 4 4
5 5 5 5 5
*/

#include<stdio.h>
int main()
{
int i,j,n;

printf("Enter no. of lines: ");
scanf( "%d",&n);


//for loop for number of lines
for(i=1;i<=n;i++)
{ //for loop for number of stars
for(j=1;j<=i;j++)
{
printf("%d ",i);
\}
\printf("\n");\
}
}
Share This
Previous Post
Next Post

FYJC XI standard online admisson Process and declaraton of Merit list . Cut off List For prevous year also . 10 Th Results onlne declaraton Maharashtra Region .

0 comments: