C for loops

V-PV-P State College, PA Member
edited June 2007 in Internet & Media
How can I get the following results using only for loops and if-statements?
wrote:
Number 1:

123454321
1234 4321
123 321
12 21
1 1

Number 2:
ABCDEDCBA
ABCD DCBA
ABC BCA
AB BA
A A
I just got a book on C and am learning it so this may be simple.

Comments

  • edited June 2007
    Well a hint i guess one can call it would be is to use characters. Notice for ascII in decimal '1' is 49, '2' is 50 and so on. That also goes for the letters 'A' is 65 and 'B' is 66. A for loop can increment up or down, so its a matter of number++; or number--;
    Hope this helps,
    Mike.
Sign In or Register to comment.