I am new to JAVA and programming in general. So please be patient with this. I am trying to output the PI in 2 decimal places, however when I input 3.14 I get an
Exception in thread "main" java.util.InputMismatchException
I feel like I am close and that I just need to adjust the code very little for this to work. I have scanned the forums for a couple of days and can't seem to get it to work. Any explanation / help would be appreciated!
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.println("What is the value of PI to two decimal places? : ");
int pi = sc.nextInt();
System.out.println("PI is: " + pi);
}