c programming - float handling

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • dazzler
    New Member
    • Nov 2007
    • 75

    c programming - float handling

    hi!

    if I have for example float x = 4923.55 and I want to check the value of the "thousands" , which is 4 how to do it? (or value of the hundreds, which is 9)
  • Meetee
    Recognized Expert Contributor
    • Dec 2006
    • 928

    #2
    Originally posted by dazzler
    hi!

    if I have for example float x = 4923.55 and I want to check the value of the "thousands" , which is 4 how to do it? (or value of the hundreds, which is 9)
    You can convert folat into integer so you will get 4923. Now you can manipulate this number by applying logic (your own) to get the solution :)

    Regards

    Comment

    • lkamikazel
      New Member
      • Dec 2007
      • 1

      #3
      I'm also having problems on doing a program like this...

      I can't actually figure out the logic...Could anyone give me a hint?

      Comment

      • mattmao
        New Member
        • Aug 2007
        • 121

        #4
        Originally posted by lkamikazel
        I'm also having problems on doing a program like this...

        I can't actually figure out the logic...Could anyone give me a hint?
        Think about the modular (%) operator...

        Comment

        Working...