/*
Q. WAP to print the following pyramid. [ e.g. if n=6 then ]
* * * * * *
* * * * *
* * * *
* * *
* *
*
*/
#include<stdio.h>
main()
{
int n,i,j;
printf("\nEnter number of lines=");
scanf("%d",&n);
for(i=1;i<=n;i++)
{
for(j=1;j<=n-i+1;j++)
{
printf("*\t");
}
printf("\n");
}
}
Q. WAP to print the following pyramid. [ e.g. if n=6 then ]
* * * * * *
* * * * *
* * * *
* * *
* *
*
*/
#include<stdio.h>
main()
{
int n,i,j;
printf("\nEnter number of lines=");
scanf("%d",&n);
for(i=1;i<=n;i++)
{
for(j=1;j<=n-i+1;j++)
{
printf("*\t");
}
printf("\n");
}
}
No comments:
Post a Comment