|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Stay one step ahead of the competition. Evaluate and give feedback
on some of the hottest web development tools on the market today.
Make your opinion heard! Click
Here
|
|
#1
|
|||
|
|||
|
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
Quote:
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.
__________________
Jason Doucette / Xona.com™ - Programming Windows Errata Addendum "Discussion is an exchange of knowledge; argument is an exchange of ignorance." |
|
#3
|
|||
|
|||
|
Yes u r right. This is what i want. Thanks for suggestion. Can u help me?
|
|
#4
|
|||
|
|||
|
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
|
|||
|
|||
|
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") |
![]() |
| Viewing: Dev Shed Forums > Programming Languages > C Programming > a C Problem |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|