Friday, February 23, 2018

C Program To Print Pattern

#include<graphics.h>
#include <stdio.h>
#include <conio.h>
void main() {
int h,m,t,temp=1;
clrscr();
for (h=1; h<=5; h++) {
for (t=temp; t<=5; t++) {
                    textcolor(b+1);
cprintf(" ");
}
for (m=0; m< a; m++) {
printf("*");
}
temp = temp + 1;
printf("\n");
}
temp = 1;
for (h=4; h>=1; h--) {
for (t=temp; t>=0; t--) {
printf(" ");
}
for (m=a; m>=1; m--) {
                        textcolor(b=1)
cprintf("*");
}
temp= temp + 1;
printf("\n");
}
getch();
}
                                                                     output

No comments:

Post a Comment