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 ?

Re: approximation 80 80

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

Re: approximation 80 80
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.

Re: approximation 80 80

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

thank u NumberFormat work :)

Re: approximation 80 80

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.19 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.