1. No Profile Picture
Junior Member
Devshed Newbie (0 - 499 posts)

Join Date
Apr 2003
Posts
8
Rep Power
0

#### a C Problem

I want to generate

A B C D F D C B A
A B C D D C B A
A B C C B A
A B B A
A A

withour using arrays and just usin loops. Can anyone help me with this one
2. #### Re: a C Problem

Originally posted by jayshah11
I want to generate

A B C D F D C B A
A B C D D C B A
A B C C B A
A B B A
A A

withour using arrays and just usin loops. Can anyone help me with this one
Did you mean:
Code:
```A B C D E D C B A
A B C D   D C B A
A B C       C B A
A B           B A
A               A```
?

Please use code tags when you wish to format text properly.
3. No Profile Picture
Junior Member
Devshed Newbie (0 - 499 posts)

Join Date
Apr 2003
Posts
8
Rep Power
0
Yes u r right. This is what i want. Thanks for suggestion. Can u help me?
4. No Profile Picture
Junior Member
Devshed Newbie (0 - 499 posts)

Join Date
Apr 2003
Posts
3
Rep Power
0
I don't have a C compiler...although here is java code
int maxCol=12;
int charCode = (int)'A';
int currCol=maxCol;
for( int row =1; row <=maxCol/2-1 ; ++row){
currCol= currCol-2;
for( int col =1; col <=currCol ; ++col){
if(col<=currCol/2)
System.out.print((char)(charCode+col-1)+" ");
else
System.out.print((char)(charCode+currCol-col)+" ");
}
System.out.println();
}
5. No Profile Picture
Junior Member
Devshed Newbie (0 - 499 posts)

Join Date
Apr 2003
Posts
3
Rep Power
0
The output of above code is
A B C D E E D C B A
A B C D D C B A
A B C C B A
A B B A
A A

You can use same logic to write C code.
or Change System.out.print --> printf
and System.out.print-->printf("\n")