float i = 55 ;
float y = 23 ;
float u = i / y ;
System.out.println(u);

i want to print u Round to five decimal places how i can do this approximation ?

Recommended Answers

Look for a concept called NumberFormat in Java. It will solve your issue.

Jump to Post

All 4 Replies

Look for a concept called NumberFormat in Java. It will solve your issue.

Member Avatar

Look up Math.round.
You'll have to do a calculation before AND after...
but I have to leave SOME work for you to do.

Look for a concept called NumberFormat in Java. It will solve your issue.

thank u NumberFormat work :)

Look up Math.round.
You'll have to do a calculation before AND after...
but I have to leave SOME work for you to do.

math.round is work but not give me the required solution that better to use NumberFormat but thank for try to help me :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.20 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.