Thursday, 3 July 2014

A diamond form by input the number

#include<stdio.h>
#include<conio.h>
void main (void)
{clrscr();
int i,j,k,l;
printf("Enter the code =");
scanf("%d",&l);
for(i=1;i<=5;i++)
{for(j=4;j>=i;j--)
{printf(" ");}
{for (k=1;k<=i;k++)
printf(" %c",l++);}
printf("\n");}
for(i=4;i>=1;i--)
{for(j=4;j>=i;j--)
{printf(" ");}
{for(k=1;k<=i;k++)
printf(" %c",l++);}
printf("\n");}
getch();
}


No comments:

Post a Comment