Formatting the output

import java.lang.*;
import java.text.*;
public class p1
{
public static void main(String args[])ja
{
double price = 200.98900;

NumberFormat f = NumberFormat.getNumberInstance();
f.setMaximumFractionDigits(2);
System.out.println(“price =” + f.format(price));

}
}

 

Share

Leave a Reply

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload CAPTCHA.