Created a Pyramid
#include<stdio.h>
#include<conio.h>
main()
{
int i,j,k, n;
printf("Enter number of rows for pyramid: ");
scanf("%d",&n);
//printf("\n");
for(i=1;i<=n;i++)
{
for(j=0;j<=(n-i);j++)
printf("+");
for(j=1;j<=i;j++)
printf("*");
for(k=1;k<i;k++)
printf("*");
printf("\n");
}
printf("\n\n");
return 0;
}
#include<stdio.h>
#include<conio.h>
main()
{
int i,j,k, n;
printf("Enter number of rows for pyramid: ");
scanf("%d",&n);
//printf("\n");
for(i=1;i<=n;i++)
{
for(j=0;j<=(n-i);j++)
printf("+");
for(j=1;j<=i;j++)
printf("*");
for(k=1;k<i;k++)
printf("*");
printf("\n");
}
printf("\n\n");
return 0;
}
No comments:
Post a Comment