Thread: How to reserved int number and print as float number ?

  1. #1
    Registered User
    Join Date
    Oct 2013
    Posts
    11

    Question How to reserved int number and print as float number ?

    How to reserved int number and print as float number ?

  2. #2
    Registered User
    Join Date
    Nov 2012
    Posts
    1,393
    It sounds like you need a typecast. Example

    Code:
    int x = 123;
    printf("%.2f\n", (float)x);

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Float point number
    By SeanRs in forum C Programming
    Replies: 3
    Last Post: 02-09-2012, 08:27 PM
  2. Multiply two float number
    By hqt in forum C++ Programming
    Replies: 3
    Last Post: 12-26-2011, 03:35 AM
  3. float number division
    By hoistyler in forum C Programming
    Replies: 6
    Last Post: 01-14-2009, 03:13 AM
  4. Triming a float number
    By RocketMan in forum C Programming
    Replies: 3
    Last Post: 10-01-2008, 08:31 AM
  5. Replies: 0
    Last Post: 03-28-2003, 08:20 AM

Tags for this Thread