0

My Java code is not giving exact output. (module project given by solo lesson 10), what is correct code please

Problem with decimals it is taking 111.1 as 112 but output is showing 111 https://code.sololearn.com/cWzSlYU3wGi7/?ref=app

22nd Jan 2021, 6:49 PM
Dhanya Raj Ravi
Dhanya Raj Ravi - avatar
2 Answers
+ 2
for(int x = 0; x < 6; x++){ amount -= (amount * 0.10); }
22nd Jan 2021, 7:24 PM
Bahha┣
Bahha┣ - avatar
+ 1
Dhanya Raj Ravi Do like this double amount = scanner.nextDouble(); for (int x=1; x<=6; ++x) { amount -= Math.ceil(amount / 10); } System.out.println((int) amount);
22nd Jan 2021, 7:23 PM
AÍąJ
AÍąJ - avatar