Thread: How to get a value Before/After a decimal point in C ??

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    May 2011
    Posts
    5

    Smile How to get a value Before/After a decimal point in C ??

    Hi,

    I'm new to C, I would like to achieve the following.

    get two numbers after the decimal point

    23.456 -> 0.45
    11.235224 -> 0.23

    and get all the numbers before the decimal point

    23.456 -> 23
    11.23 -> 11
    .42 -> 0

    How can I do it? I know it might be easy to some, but for me I still don't feel comforatble with C.
    Last edited by ammar555; 05-18-2011 at 12:55 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. how to remove zero after decimal point
    By abhay_m8 in forum C++ Programming
    Replies: 3
    Last Post: 04-21-2007, 12:11 AM
  2. Changing decimal point
    By Ikon in forum C Programming
    Replies: 7
    Last Post: 03-01-2006, 06:36 PM
  3. decimal point allignment
    By Max in forum C++ Programming
    Replies: 2
    Last Post: 10-21-2002, 10:27 PM
  4. Testing for a decimal point
    By face_master in forum C++ Programming
    Replies: 1
    Last Post: 05-14-2002, 12:46 AM
  5. Replies: 3
    Last Post: 11-28-2001, 07:53 AM