C Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming LanguagesC Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
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  
Old April 24th, 2003, 07:33 AM
jayshah11 jayshah11 is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2003
Posts: 8 jayshah11 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 m 29 sec
Reputation Power: 0
Send a message via Yahoo to jayshah11
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

Reply With Quote
  #2  
Old April 24th, 2003, 08:23 AM
Jason Doucette's Avatar
Jason Doucette Jason Doucette is offline
jasondoucette.com
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2003
Location: Canada
Posts: 378 Jason Doucette User rank is Private First Class (20 - 50 Reputation Level)Jason Doucette User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 7 h 23 m 8 sec
Reputation Power: 6
Re: a C Problem

Quote:
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.

Reply With Quote
  #3  
Old April 24th, 2003, 08:30 AM
jayshah11 jayshah11 is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2003
Posts: 8 jayshah11 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 m 29 sec
Reputation Power: 0
Send a message via Yahoo to jayshah11
Yes u r right. This is what i want. Thanks for suggestion. Can u help me?

Reply With Quote
  #4  
Old April 24th, 2003, 10:04 AM
anu_sh anu_sh is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2003
Posts: 3 anu_sh User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation 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();
}

Reply With Quote
  #5  
Old April 24th, 2003, 10:07 AM
anu_sh anu_sh is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2003
Posts: 3 anu_sh User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation 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")

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesC Programming > a C Problem


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway