- Back to Home »
- Colourful Diamond (C Program)
#include<stdio.h>
#include<conio.h>
#include<windows.h>
void gotoxy(int,int);
int main()
{
int i,j,k;
char a[5];
system("color 4E");
printf("Please maximize your screen,then press any key");
getch();
system("cls");
for(i=0;i<=22;i++)
{
for(j=22;i<=j;j--)
{
printf("%c",178);
Sleep(10);
}
for(j=1;j<i*2;j++)
{
printf(" ");
}
for(j=22;i<=j;j--)
{
printf("%c",178);
Sleep(10);
}
printf("\n");
}
for(i=0;i<=21;i++)
{
for(j=-1;j<=i;j++)
{
printf("%c",178);
Sleep(10);
}
for(j=40;j-i>=i;j--)
{
printf(" ");
}
for(j=-1;j<=i;j++)
{
printf("%c",178);
Sleep(10);
}
printf("\n");
}
gotoxy(19,23);printf("insan");gotoxy(1,52);
system("pause");
}
//This function is for location
void gotoxy(int i,int j){
COORD aa={i,j};
SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE),aa);
}