Browse » Home
»
Program to make differnt colored stairs like blocks
» Program to create differnt colored stairs like blocks
Program to create differnt colored stairs like blocks
Program to create different color stairs like 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<y; z++)
{
textbackground(x);
cprintf(" "); //here cprintf is printing colored space character
}
printf("\n");
}
printf("\n\n");
}
getch();
}
Output :
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment