You can divide a number by a larger number - in non-integer mode.

Is this what you need?
public class Rate {
  static float rate (float percent) {
    return (percent / 100);
  }

    public static void main(String[] args) {
      System.out.println (rate (10));
      System.out.println (rate (20));
    }
}
run:
0.1
0.2
BUILD SUCCESSFUL (total time: 0 seconds)
   

Shawn Ayromloo


Anton Shaykin wrote:
Since you cannot devide a smaller nuber with a larger number. is there
any other way?
    
What do you mean by this?

On Mar 12, 10:22 pm, Jerrold <[email protected]> wrote:
  
Hi,

Can anyone help me on this. can anyone give me an idea on how to
convert a desimal number to its percent equivalent like, i want to
have a function that would take a decimal number as its parameter then
it would convert the decimal into the percentage equivalent of that
decimal.
e.g:  10% of 100 = .1 so if i would enter a value 10 to the function.
the result would be .1

Since you cannot devide a smaller nuber with a larger number. is there
any other way?

Thanks in advance!
Dave
    



  


--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [email protected]
For more options, visit this group at http://groups.google.com/group/javaprogrammingwithpassion?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to