Computer Science, asked by LikithaGN, 7 months ago

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 sufiyanansari6286
0

Answer:

your answer is here

Explanation:

sum of its digits (3+7+5) is 15

Answered by CopyThat
3

Program: {JAVA}

import java.util.*;

public class Brainlt

{

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");

}

}

}

Similar questions