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"); } } }
3 Answers
+ 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");
+ 2
Credits to: SÄñtösh He helped me with the same problem too
+ 1
Thanks! It really helped me