Search & Find out

Sunday, December 6, 2009

Diomand By Asterix Symbols

#include "stdio.h"
#include "conio.h"

void main()
{
  int a,b,c,d,n,m,x;
  clrscr();

  printf("Welcome to astrick Diomand\n\n");
  printf("Enter a number  ");
  scanf("%d",&n);

   m=n-1;
   d=1;x=1;


   for(a=1; a<=n; a++)
   {
     for(b=1; b<=m; b++)
     {
       printf("   ");
     }

     for(c=1; c<=d; c++)
     {
       printf("*  ");
     }

     printf("\n");
     m--;
     d+=2;
   }

   m=(n*2)-3;

   for(a=1; a
   {
     for(b=1; b<=x; b++)
     {
       printf("   ");
     }

     for(c=1; c<=m; c++)
     {
       printf("*  ");
     }

     printf("\n");
     x++;
     m=m-2;
   }

   getch();
 }



Get the executable ( .exe ) file for this program..
Download

0 comments:

Post a Comment

 

My Blog List

Term of Use