C Program – Display all type of pyramids

by Nideesh C on May 9, 2011 · 0 comments

in C Programming




//Downloaded From theonlinetutorials.com
#include<stdio.h>
#include<conio.h>
void main()
{
int n=6,k,i,j;
clrscr();
printf("How many star you want ");
scanf("%d",&n);
for(i=1;i<=n;i++)
{
printf("\n");
for(j=1;j<=i;j++)
printf(" *");
}
getch();

for(i=1;i<=n;i++)
{
printf("\n");
for(k=n;k>=i;k--)
printf(" ");
for(j=1;j<=i;j++)
printf(" *");
}
getch();

for(i=1;i<=n;i++)
{
printf("\n");
for(k=n;k>=i;k--)
printf(" ");
for(j=1;j<=i;j++)
printf("*");
}
printf("\n");
getch();

for(i=1;i<=n;i++)
{
printf("\n");
for(k=1;k<=i;k++)
printf(" ");
for(j=n;j>=i;j--)
printf(" *");
}
getch();
}



Not Satisfied ? Just search & get the result

Related Posts Plugin for WordPress, Blogger...
Be Sociable, Share!

Related posts:

  1. C Program – Display a line graph using midpoint line algorithm.
  2. C Program – Implement the midpoint circle drawing algorithm
  3. C program to display the inventory of items in a store/shop The inventory maintains details such as name, price, quantity and manufacturing date of each item.
  4. C program to accept an array of 10 elements and swap 3rd element with 4th element using pointers. And display the results
  5. C Program – Draw a rectangle and perform the operations.

Leave a Comment

Previous post:

Next post: