Thread: "writing reverse of a number" i need your help

  1. #1
    Registered User
    Join Date
    Aug 2006

    Question "writing reverse of a number" i need your help

    Hi everybody;
    i need a program that writes reverse of a number for ex;
    if i enter 42 output will be 24 and, for 789 it will be 987.
    We don't know how many digits will user type...
    Thanks... Have a nice day...

  2. #2
    Registered User Tonto's Avatar
    Join Date
    Jun 2005
    New York
    Hint. 24 / 10 = 2 remainder 4.

  3. #3
    The Richness... Richie T's Avatar
    Join Date
    Jan 2006
    Or you could read as a string and print out the string in reverse - also allows you
    to easily validate the input - use fgets to read a string if you don't know how to
    already. Tonto's solution is the most common answer to this question, so
    whichever suits you.
    No No's:
    fflush (stdin); gets (); void main ();

    Example of fgets (); The FAQ, C/C++ Reference

    My Gear:
    OS - Windows XP
    IDE - MS Visual C++ 2008 Express Edition

    ASCII stupid question, get a stupid ANSI

  4. #4
    Registered User
    Join Date
    Aug 2006
    Tonto and Richie T. thanks for your attention. I hope i will write true code after your help...

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Problem with my reverse function and its output!
    By Matus in forum C Programming
    Replies: 4
    Last Post: 04-29-2008, 08:33 PM
  2. a reverse function
    By AngKar in forum C Programming
    Replies: 20
    Last Post: 04-27-2006, 10:35 PM
  3. Using reverse iterators in algorithms
    By 0rion in forum C++ Programming
    Replies: 1
    Last Post: 02-27-2006, 02:19 AM
  4. gethostbyaddr() reverse lookups failing (???)
    By Uncle Rico in forum C Programming
    Replies: 9
    Last Post: 08-19-2005, 09:22 AM
  5. Replies: 7
    Last Post: 03-18-2003, 02:32 PM
Website Security Test