Wednesday, August 17, 2011

QUES 14 AlphaBet Pattern


C LANGUAGE BOOK


















WAP TO PRINT THE ALPHABET IN FOLLOWING PATTERN.
















#include<stdio.h>

int main()
{
int p = 6,c = 2,i,q;
clrscr();

for(i = 65 ; i < 65+7; i++)
{
printf("%c%s", i," ");
}
for(i = 70 ; i > 64; i--)
{
printf("%c%s", i, " ");
}
printf("\n");

sort(p, c);
printf("\n");

return;
}

sort(int q, int c)
{
int i;
for(i = 65 ; i < 65+q; i++)
{
printf("%c%s", i," ");
}

if(q != 0)
{
for(i = 0; i < c; i++)
{
printf("%s"," ");
}
 order(q-1, c);
}
}

order(int p, int c)
{
int i;

for(i = 65+p ; i > 64; i--)
{
printf("%c%s", i, " ");
}
 if(p!=0)
  {
  printf("\n");
  c = c+4;
  sort(p, c);
  }
}


WAP TO PRINT THE ALPHABET IN FOLLOWING PATTERN.
 





















 
 #include<stdio.h>
int main()
{
int i=0,j=0;

clrscr();
for(i=0;i<6;i++)
{
printf("\n");

for(j=0;j<9;j++)
{
if(i==2||i==3)
{
  printf("*");
}
else
{
if(j==3 || j==4 || j==5)
 printf("_");
else
 printf("*");
}
}
}
}

WAP TO PRINT THE ALPHABET IN FOLLOWING PATTERN.


















 #include<stdio.h>
int main()
{
int i=0,j=0;

clrscr();
for(i=0;i<5;i++)
{
printf("\n");

for(j=0;j<9;j++)
{
if(i==3)
{
if(j==0)
{
printf("_");
}
else
{
printf("*");
}
}
else
if(i==4)
{
if(j==0 || j==1)
{
 printf("_");
}
else
if(j==2 || j==8)
{
 printf(" ");
}
else
{
printf("*");
}
}
else
{
if(j==3 || j==4 || j==5)
 printf("_");
else
 printf("*");
}
}
}
}

WAP TO PRINT THE ALPHABET IN FOLLOWING PATTERN.







#include<stdio.h>
int main()
{
int i=0,j=0;

clrscr();
for(i=0;i<6;i++)
{
printf("\n");
for(j=0;j<53;j++)
{
if(i==0)
{
if(j==0 || j==1 || j==2 || j==3 || j==4 || j==10 || j==17 || j==23 || j==25 || j==28 || j==36 || j==46 || j==47 || j==48 || j==49 || j==50)
 printf("*");
else
 printf(" ");
}

if(i==1)
{
if(j==0 || j==4 || j==9 || j==11 || j==17 || j==19 || j==23 || j==25 || j==27 || j==35 || j==37 || j==48)
 printf("*");
else
 printf(" ");

}
if(i==2)
{
if(j==0 || j==1 || j==2 || j==3 || j==4 || j==8 || j==12 || j==17 || j==20 || j==23 || j==25 || j==26 || j==34 || j==38 || j==48)
 printf("*");
else
 printf(" ");
}
if(i==3)
{
if(j==0 || j==7 || j==8 || j==9 || j==10 || j==11 || j==12 || j==13 || j==17 || j==21 || j==23 || j==25 || j==26 || j==33 || j==34 || j==35 || j==36 || j==37 || j==38 || j==39 || j==48)
 printf("*");
else
 printf(" ");
}
if(i==4)
{
if(j==0 || j==6 || j==14 || j==17 || j==17 || j==22 || j==23 || j==25 || j==27 || j==32 || j==40 || j==43 || j==48)
 printf("*");
else
 printf(" ");
}
if(i==5)
{
if(j==0 || j==5 || j==15 || j==17 || j==23  || j==25 || j==28 || j==31 || j==41 || j==43 || j==44 || j==45 || j==46 || j==47 ||  j==48)
 printf("*");
else
 printf(" ");
}



}
}
}









C LANGUAGE BOOK


No comments:

Post a Comment