+ 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; } }
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' ☝
+ 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.
+ 3
What are you trying to do?
It would be helpful if you put the code into a script instead of the description