I was doing a simple calculation program in java when I encountered this problem. I want to convert centimeter square to meter square. 1 cm² = 0.0001 m². When i create the program in java to do this conversion I got result in '1.0E-4' instead of '0.0001'. I don't know why it is showing in that way. may someone guide me how to do it or something that may help
Here is the code:
import java.io.*;
class First {
public static void main(String x[]) {
try {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
System.out.println("Please Enter the number");
double number = Double.parseDouble(br.readLine());
double d1 = 0.0001;
double result = number * d1;
System.out.println("Result is " + result);
} catch(Exception ex) {
ex.printStackTrace();
}
}
}