0

Favorite ";"

import java.util.Scanner; public class Program { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int amount = scanner.nextInt(); int x = 20000; int b = 18000; int c = 16200; for(int x%10; b%10; c%10){ System.out.println(c); } /* 1 - 18000 2 - 16200 3 - 14580 */ switch(amount){ case 1: System.out.print(18000); break; case 2: System.out.print(16200); break; case 3: System.out.print(14580); break; } } } Where I didn't put ";", I can't find it ;)

20th Aug 2022, 4:01 PM
Akridem
Akridem - avatar
29 Respuestas
+ 1
Геобс Акк Use for loop till 3 iteration and inside loop get 10% of amount then subtract from amount then assign to amount. Finally print amount outside tha loop 10% of 20000 = 2000 now 20000 - 2000 = 18000 so amount = amount - amount * 10 / 100; write this inside loop
20th Aug 2022, 4:11 PM
A͢J
A͢J - avatar
+ 1
I think he is trying to solve Loan Calculator Project
20th Aug 2022, 4:17 PM
A͢J
A͢J - avatar
+ 1
Геобс Акк So the formula is amount = amount - amount * 10 / 100; Write this inside for loop and loop will work till i < 3 Outside the loop print amount
20th Aug 2022, 4:20 PM
A͢J
A͢J - avatar
+ 1
Геобс Акк I said use for loop and use that formula. No need to write Hard Code logic
20th Aug 2022, 4:32 PM
A͢J
A͢J - avatar
+ 1
Геобс Акк That is not right. You have to learn how to use loops for(int x = 0; x < 3; x++) { amount = amount - amount * 10 / 100; } System.out.println(amount);
20th Aug 2022, 4:44 PM
A͢J
A͢J - avatar
+ 1
Тебе надо не числа подставлять в программу, а переменные
20th Aug 2022, 4:44 PM
Yaroslav Vernigora
Yaroslav Vernigora - avatar
+ 1
A question without a context !!
22nd Aug 2022, 9:47 AM
Vinay K
Vinay K - avatar
0
int x%10; c%10 what these means?
20th Aug 2022, 4:04 PM
Jayakrishna 🇮🇳
0
I wanted to write down the percentage of the debt digit x
20th Aug 2022, 4:06 PM
Akridem
Akridem - avatar
0
percent_10 = (x/100)*10
20th Aug 2022, 4:11 PM
Yaroslav Vernigora
Yaroslav Vernigora - avatar
0
In your loop, int x%10; is invalid statement. If on corrected , when b%10 is 0 then only loop stops.. c%10 has no effect statement. " Percentage of debt digit x " Not understood what do you mean? What is the purpose of you for loop...
20th Aug 2022, 4:11 PM
Jayakrishna 🇮🇳
0
Jayakrishna🇮🇳 he wants to take a percentage of the number, only it is not clear how much? 10% or 90%?
20th Aug 2022, 4:13 PM
Yaroslav Vernigora
Yaroslav Vernigora - avatar
0
ПроцентОтЧисла = (Число : 100) * х, где х - это количество процентов, которые нам нужны. по сути мы полное число делим на 100, узнаем, чему равен 1%, затем умножаем на кол-во %, которое нам необходимо
20th Aug 2022, 4:15 PM
Yaroslav Vernigora
Yaroslav Vernigora - avatar
0
10 percent
20th Aug 2022, 4:16 PM
Akridem
Akridem - avatar
0
Yes
20th Aug 2022, 4:17 PM
Akridem
Akridem - avatar
0
import java.util.Scanner; public class Program { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int amount = scanner.nextInt(); percent_10 =20000 - (20000/100)*10; System.out.println(Month1); percent_10 =18000 - (18000/100)*10; System.out.println(Month2); percent_10 =16200 - (16200/100)*10; System.out.println(Month3); } } What did I do wrong?
20th Aug 2022, 4:31 PM
Akridem
Akridem - avatar
0
Yes, ok, I'll try
20th Aug 2022, 4:33 PM
Akridem
Akridem - avatar
0
import java.util.Scanner; public class Program { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int amount = scanner.nextInt(); for (20000-20000/100*10 ; i<3); System.out.println(Month1); for (18000-18000/100*10 ; i<3); System.out.println(Month2); for (16200-16200/100*10 ; i<3); System.out.println(Month3); } }
20th Aug 2022, 4:39 PM
Akridem
Akridem - avatar
0
Does not work/
20th Aug 2022, 4:39 PM
Akridem
Akridem - avatar
0
Да, хорошо, тупанул как всегда/
20th Aug 2022, 4:48 PM
Akridem
Akridem - avatar