how to type two decimal places in java? ex- INPUT - 12.367 OUTPUT - 12.37 WITHOUT USING MATH CLASS
Answers
Answered by
4
you could use
___________________________________
public class program{
double x=12.367;
String str=String.format("%.2f", x);
System.out.println(str);
}
___________________________________
public class program{
double x=12.367;
String str=String.format("%.2f", x);
System.out.println(str);
}
Attachments:
ashamishra170pci228:
thank thank thank thank thank thank thank thank you sooooooooooo much
Similar questions