#include
#include
#include
void main(){ clrscr(); int h,i,j,x,y,choice,X;
getch(); clrscr(); gotoxy(25,4);textcolor(LIGHTRED);cprintf("\nEnter your favorite number:"); textcolor(WHITE);scanf("%d",&h); getch(); clrscr(); gotoxy(25,5);textcolor(CYAN);cprintf("\nSelect pattern you like to appear!"); gotoxy(25,7);textcolor(BLUE);cprintf("\n\t[A] for Pattern 1"); gotoxy(25,8);textcolor(DARKGRAY);cprintf("\n\t[N] for Pattern 2"); gotoxy(25,9);textcolor(LIGHTGREEN);cprintf("\n\t[I] for Pattern 3"); gotoxy(25,10);textcolor(YELLOW);cprintf("\n\t[T] for Pattern 4"); gotoxy(25,12);textcolor(RED);cprintf("\nEnter your choice Pattern here:"); textcolor(WHITE);scanf("%s",&choice); getch(); clrscr();switch(choice){ case 'A': for(i=1,y=15;i<=h;i++,y++) { for(j=1,x=40;j<=i;j++,x++) { gotoxy(x,y); printf("*"); } } break; } getch(); clrscr();switch(choice){ case 'N': for(i=1,y=15;i<=h;i++,y++) { for(j=1,x=40;j<=i;j++,x--) { gotoxy(x,y); printf("*"); } } break; } getch(); clrscr();switch(choice){ case 'I': for(i=h,y=15;i<=h;i--,y++) { for(j=i,x=40;j>=1;j--,x++) { gotoxy(x,y); printf("*"); } } break; } getch(); clrscr();switch(choice){ case 'T': for(i=h,y=15;i>=1;i--,y++) { for(j=i,x=40;j>=1;j--,x--) { gotoxy(x,y); printf("*"); } } break; }
gotoxy(5,20);textcolor(MAGENTA);cprintf("thank you for your choice the pattern...,see you!!!!bye...bye...bye..."); getch(); }
No comments:
Post a Comment