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.

Recommended Answers

All 6 Replies

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

Do you really want that printf there?

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

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

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.

I got it must have been A++ line 25

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.