Wednesday, September 29, 2010

Program to print serises of ABCDEEDCBA

/**************************************************
********** Program to print output as *************
* ABCDEFEDCBA *
* ABCDE   EDCBA *
* ABCD        DCBA *
* ABC              CBA *
* AB                    BA *
* A                         A *
**************************************************/
#include
#include
void main()
{
  char ch;
  int i,j,m,k;
  clrscr();
  k=0;
  printf("Enter any Character");
  scanf("%c",&ch);
  toupper(ch);
for(i=ch;i>='A';i--)
{
  for(j='A';j<=i;j++) { printf("%c",j); } for(m=0;m='A';m--)
   {
    if(m!=ch)
    printf("%c",m);
   }
   printf("\n");
}
getch();
}

No comments:

Post a Comment