when you use floating points and do the coding normally you get 4 decimal points. . but if i want to make it to 2 decimal points. how can the program should be. please help me out
here is the program i did
/**
* @(#)Average.java
*
*
* @author
* @version 1.00 2008/7/8
*/
import java.io.*;
public class Average {
public static void main(String args[])throws IOException
{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
float x=0;
float num[]=new float[10];
for(int i=0;i<10;i++)
{
System.out.println("Enter the Value");
num= Float.parseFloat(br.readLine());
x += num;
}
float avg=x/10;
System.out.println("The Average is " +avg);
}
}