+ 1

Why it shows wrong output when I write (10/100*amount) instead of (amount*10/100)

import java.util.Scanner; public class Program { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int amount = scanner.nextInt(); for(int i=0 ; i<3 ; i++) { amount-= (amount*10/100) ; } System.out.println(amount); } }

13th Dec 2021, 6:03 PM
Priyanka Singh
Priyanka Singh - avatar
4 Antworten
+ 1
Now I got! Thank you
13th Dec 2021, 6:17 PM
Priyanka Singh
Priyanka Singh - avatar
+ 1
result= amt*10; b= result/100;
20th Dec 2021, 8:58 AM
Yamima Thapa
Yamima Thapa - avatar
0
so it shows wrong result, not error..
13th Dec 2021, 10:21 PM
zemiak