Hey guys,
So I want to format a number 54.366586669985, but I want the users to decide how many places they want they want to go to. So I asked them how many places they want to go to in a variable
so for example they input 45.6666666666, but they only want it to print to the second decimal 45.66 so they would input in the second option 2
So I want to format a number 54.366586669985, but I want the users to decide how many places they want they want to go to. So I asked them how many places they want to go to in a variable
Scanner scan = new Scanner(System.in);
int placesnum;
double num;
System.out.print("Enter a double number: ")
num = scan.nextDouble();
System.out.print("How many places you want the number print to? ")
placesnum = scan.nextInt();
so for example they input 45.6666666666, but they only want it to print to the second decimal 45.66 so they would input in the second option 2