Techknow Study

DIAMOND.........

5:43:00 PM vikas 0 Comments Category :

DIAMOND:-
Hey guys as I given you simple structure to draw previously,
now it’s time for a typical one. So I mentioned a typical question
just try to solve self than if u will not get success than see the code for that.


  ProGram:-

#include<conio.h>
#include<stdio.h>
void main()
{
int i,j,k;
clrscr();
for(i=1;i<=5;i++)
{
printf("\n");
for(j=5;j>=i;j--)
{
printf("*");
}
for(j=1;j<=5;j++)
{
if((5-j)<=(i-1))
{
printf(" ");
}
}
for(j=1;j<=5;j++)
{
if(j>=i)
printf("*");
else
printf(" ");
}
}
printf("\n   DIAMOND");
for(i=1;i<=5;i++)
{
printf("\n");
for(j=1;j<=5;j++)
{
//printf("\n");
if(j<=i)
printf("*");
else
printf(" ");
}
printf(" ");
for(j=1;j<=5;j++)
{
if((5-j)<=(i-1))
{
printf("*");
}
else
printf(" ");
}
}
getch();
}

..............


RELATED POSTS

0 comments