0

I can't get the output correctly, here in the 1st line in the for loop.this rem=amount*(10/100); and rem=(amount*10)/100;no same

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

13th Apr 2021, 2:11 PM
Vijay S
Vijay S - avatar
4 Réponses
+ 1
Hope this helps you
13th Apr 2021, 2:17 PM
Atul [Inactive]
+ 1
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 mouth = 0; mouth < 3; mouth++){ amount = amount - (amount / 10); } System.out.println(amount); } } //Indeed this are the changes you should bring in your code
13th Apr 2021, 2:19 PM
Atul [Inactive]
0
Thank you
18th Apr 2021, 8:49 AM
Vijay S
Vijay S - avatar