0

Argentina

Can someone please tell me what's wrong with my code? It just doesn't work with one case(case 4) but I really don't know why it doesn't work with that case. I would really appreciate it if someone can help me with this import java.util.Scanner; public class Program { public static void main(String[] args) { Scanner in = new Scanner(System.in); int precioP = in.nextInt(); int precioD = in.nextInt(); int dolar = 50 * precioD; int pesoA = precioP; if(dolar >= pesoA){ System.out.print("Pesos"); }else if(dolar < pesoA){ System.out.print("Dollars"); } } }

7th Dec 2020, 2:37 AM
Itzel Medina
Itzel Medina - avatar
3 Réponses
+ 2
Hope this helps. int precioP = in.nextInt(); int precioD = in.nextInt(); double dolar = 0.02 * precioP; if(dolar < precioD){ System.out.print("Pesos"); }else if(dolar > precioD){ System.out.print("Dollars");
7th Dec 2020, 2:49 AM
noteve
noteve - avatar
+ 2
Credits to: Såñtösh He helped me with the same problem too
7th Dec 2020, 3:27 AM
noteve
noteve - avatar
+ 1
Thanks! It really helped me
7th Dec 2020, 3:20 AM
Itzel Medina
Itzel Medina - avatar