0
help me w this code pls .... please teach me a lil about scanner code input
You can win prizes by playing the lottery. If the ticket number is a multiple of 10 and 9, the program outputs “You won $200”. If it is a multiple of 4 or 6, the program outputs “You won $50”. In all other cases, there is no prize and the output is “Try again”. Sample Input 11457 Sample Output Try again Hint Number a is a multiple of number b, if a%b == 0.
2 Respuestas
+ 2
On the top of your code import util package like this 👇 as scanner class is in util package
import java.util.*;
Then in your code create an object for scanner class 👇
Scanner sc=new Scanner (System.in);
Then for your input
int n=sc.nextInt();
☝️ This will take the input
I hope your doubt will clear now
0
thank you