+ 3

Help me to understand (Помогите разобраться)

payment is considered incorrect (Неверно считается платёж). https://code.sololearn.com/c42lZ6vs3Z2i/?ref=app

30th Aug 2021, 3:28 PM
Евгений Рудько
Евгений Рудько - avatar
3 Answers
+ 1
You should update the payment, too (in each iteration): 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 = 1; i < 4; i++){ int payment = amount/10; amount = amount - payment; } System.out.println(amount); } }
30th Aug 2021, 3:41 PM
David García Prados
+ 1
Thanks. the first test passes, but on the second test there is an error. fixed the code
30th Aug 2021, 6:24 PM
Евгений Рудько
Евгений Рудько - avatar
0
Jzxn9
7th Sep 2021, 9:41 PM
Mohamad Marda Mrda
Mohamad Marda Mrda - avatar