+ 1

What is the mistake

import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner read = new Scanner(System.in); int number = read.nextInt(); if(number%9==0 && number%10==0){ System .out.println ("You won $200"); } if(number%4==0 || number%6==0){ System .out .println ("You won $50"); } else{ System .out.println ("Try again"); } //your code goes here; } }

25th Nov 2021, 7:38 PM
Achraf Soua
3 odpowiedzi
+ 4
Try to use `else if` for the second conditional (won $50). And please tag a relevant language (Java) rather than just 'help' ☝
25th Nov 2021, 7:48 PM
Ipang
+ 4
Well my first question is what are the instructions. So the first test is if number is divisible by 9 and 10 evenly. So 90 is and so is 180 but 150 is not. Neither is 9 or 10, but without the requirements it's hard to say what the issue is.
25th Nov 2021, 7:47 PM
Paul K Sadler
Paul K Sadler - avatar
+ 3
What are you trying to do? It would be helpful if you put the code into a script instead of the description
25th Nov 2021, 7:44 PM
Lisa
Lisa - avatar