My 5th case Everytime failed. Anyone can help me? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

My 5th case Everytime failed. Anyone can help me?

import java.util.Scanner; public class Program { public static void main(String[] args) { Scanner x = new Scanner(System.in); int x1 = x.nextInt (); int y1 = x.nextInt (); int dollar = 50*y1; if (dollar<=x1) { System.out.println("Dollars"); } else { System.out.println("Pesos"); } } }

14th Apr 2020, 10:03 AM
Akash Agrawal
Akash Agrawal - avatar
1 Answer
+ 2
Akash Agrawal , declare the variable dollar as double type. Change 50 => 50.0. Change also in the if statement dollar < x1. Now I think it works 🐱
14th Apr 2020, 10:18 AM
TheWh¡teCat 🇧🇬
TheWh¡teCat 🇧🇬 - avatar