Program to create different color blocks




















Program to create different color blocks

Note :
textbackground() selects a new color for background, the argument passed is the color

cprintf() is used to output colored text


Program :


#include <stdio.h>
#include <conio.h>

void main()
{
int x;
int y;
int z;

clrscr();

for(x=1; x<5; x++)
{
for(y=1; y<5; y++)
{
for(z=1; z<5; z++)
{
textbackground(x);
cprintf(" "); //here cprintf("") is printing colored 'space' character
}
printf("\n");
}
printf("\n\n");
}
getch();
}

Output :

0 comments:

Post a Comment