Please check out This
Output required

Aa
      Cc Bb
   Dd Ee Ff
jj Ii Hh Gg
#include<stdio.h>
#include<conio.h>
void main()
{
 char a = 'a',a1 ='a',A = 'A',A1='A';
 int i,j,n;
 clrscr();
 for(i =1;i<=4;i++,printf("\n"))
 {
   if(i%2!=0)
   for(j = 1;j<=i;j++)
   {
       printf("%c%c ",a,A);
       a++;
       A++;
   }
   else
   {
    a1 = a-1;
    A1 = A-1;
   for(n = i;n>=1;n--)
    {
     printf("%c%c ",a1+n,A1+n);
     a++;
     A1++;
    }
   }
  }

}

Its comming partial right. That is small letters follow the pattern but big ones aren't.

Edited 6 Years Ago by Rahul.menon: n/a

for(i =1;i<=4;i++,printf("\n"))

Do you really want that printf there?

Edited 6 Years Ago by Martin B: n/a

That A1++ on line 25 looks iffy to me.
It doesn't rhyme with the a++ on the previous line.

Edited 6 Years Ago by Martin B: n/a

hello,
plz tell me you wanna help or the exact code...
if you want help or hint I can tell you it is possible using nested loop like this

for (initialization ; condition; increment)
{
        for (initialization ; condition; increment)
        {
                // code for printing spaces because before your character
                // there are some spaces printed on the screen
        }
        for (initialization ; condition; increment)
        {
                // code for your alphabets
        |
}

this pattern will solve your problem....

and answer will

Aa
      Cc Bb
   Ff Ee Dd
Jj Ii Hh Gg

Edited 6 Years Ago by progneer.soft: n/a

I am helping you. I've just told you that the error is on line 25.
Can you really not tell what that line should be?
Did you write the code?

progneer.soft the pattern is 
         Aa
      Cc Bb
   Dd Ee Ff
jj Ii Hh Gg

and not
         Aa
      Cc Bb
   Ff Ee Dd
Jj Ii Hh Gg

I want the exact code my code is putting the small letters in right sequence,prblm is the bigs. Ideally it shdnt have been.

Edited 6 Years Ago by Rahul.menon: n/a

I got it must have been A++ line 25

Edited 6 Years Ago by Rahul.menon: n/a

This article has been dead for over six months. Start a new discussion instead.