Tuesday, December 4, 2012

Pattern On Characters Using C Language





Here is a pattern given below and the pattern will be displayed using C Language.



ABCDE
BCDE
CDE
DE
E
f
fg
fgh
fghi
fghij




#include<stdio.h>
void main()
{
 int i,j,n=5;
 char ch;
 clrscr();
     for(i=0;i< 10;i++)
      {
            if(i< 5)
            {
                ch='A';
            ch=ch+i;
    }
    else
    ch='f';

               for(j=0;j< n;j++)
               {
                   printf("%c",ch);
            ch=ch+1;
                        }
                  if(i>=5)
                  n++;
                  else if(i< 4)
                  n--;
               printf("\n");

    }
getch();
}




No comments:

Post a Comment

Subscribe via email

Enter your email address:

Delivered by FeedBurner