help! java is really confusing :/ idk where did this thing (amount-=pay;) came from besides, i have no idea how to use it++ :< | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
0

help! java is really confusing :/ idk where did this thing (amount-=pay;) came from besides, i have no idea how to use it++ :<

/* since every quiz here are all difficult compared to the first discussion i've learned and quite far to each other. can someone help and explain it to me what is it for?(i'm basically have low knowledge when it comes to math) TIA :) */ import java.util.Scanner; public class ivor{ public static void main(String[]args){ Scanner scanner = new Scanner(System.in); int amount = scanner.nextInt(); int month= 1; while(month<=3){ int pay= amount/10*1; amount-=pay; month++; } System.out.println(amount); } } /* for loop Scanner scanner = new Scanner(System.in); int amount = scanner.nextInt(); int month = 1; for(month = 1; month<= 3; month++){ int pay= amount/10*1; amount-=pay; } System.out.println(amount); */

18th Sep 2022, 11:04 PM
ivor
ivor - avatar
1 Resposta
19th Sep 2022, 5:05 AM
BroFar
BroFar - avatar