Write a program to create the following Pyramid using C program?
1 2 3 4 5
1 2 3 4
1 2 3
1 2
1
*****************************Program*****************************
#include<stdio.h>
#include<conio.h>
main()
{
int r,c,k,m;
printf("Enter the number of lines : ");
scanf("%d",&m);
for(r=0;r<=m-1;r++)
{
for(k=0;k<=r;k++)
{
printf(" ");
}
for(c=1;c<=m-r;c++)
{
printf(" %d",c);
}
printf("\n");
}
getch();
return 0;
}
*************************Output***********************************
|
Screen shot for opposite pascal triangle |
No comments