The UNIX and Linux Forums
>
Top Forums
>
High Level Programming
how do I calculate percentage ?
.
User Name
Remember Me?
Password
google unix.com
Forums
Register
Forum Rules
Links
Albums
FAQ
Members List
Calendar
Search
Today's Posts
Mark Forums Read
Thread
:
how do I calculate percentage ?
View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
#
7
(
permalink
)
04-18-2007
tantric
Registered User
Join Date: Apr 2007
Posts: 23
since a and b are int b/a will return 0.
So, b/a * 100 will return 0. But since f is float, f will be 0.0
I think this works:
f = ((float)b * 100)/a
tantric
View Public Profile
Find all posts by tantric
Find tantric's past nominations received
Find tantric's present nominations given