write a program to input an integer and check whether it is divisible by 3 or not using switch case only (No if else statement should be used)
Answers
Answered by
7
Answer:
Explanation:
import java.util.*;
public class Brainly
{
static void main()
{
Scanner sc=new Scanner(System.in);
int n;
System.out.println("Enter a number");
n=sc.nextInt();
switch(n%3)
{
case 0:
System.out.println("Divisible by 3");
break;
default:
System.out.println("Not divisible by 3");
}
}
}
Answered by
0
S.o.pln means System.out.println
Attachments:
Similar questions