#include
#include
void main()
{
int a,b,c;
int choice;
clrscr();
printf("Enter a number:");
scanf("%d",&a);
printf("\n\t\t[1]-Pattern 1\n\n");
printf("\t\t[2]-Pattern 2\n\n");
printf("\t\t[3]-Pattern 3\n\n");
printf("\t\t[4]-Pattern 4\n\n");
printf("Select your choice:");
scanf("%d",&choice);
switch(choice)
{
case 1:
printf("\n ");
for(b=1; b<=a;b++) { for(c=1;c<=b;c++) printf("*",c); printf("\n"); } break; case 2: printf("\n"); for(c=a;c>=1;c--)
{
for(b=1;b<=c;b++) printf("*",c); printf("\n"); } break; case 3: printf("\n"); for(b=1;b<=a;b++) { for(c=1;c<=(a-b);c++) printf(" "); for(c=1;c<=b;c++) printf("*"); printf("\n"); } break; case 4: printf("\n"); for(int b=a-1;b>=0;b--)
{
for(int c=b; c
printf(" ");
for(int d=0;d<=b; d++) printf("*"); printf("\n"); } break; } getch(); }
Monday, February 9, 2009
Posted by aw ulaw man pud ta ani at 3:50 AM
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment