Question: I cant figure thisGiven an integer N , find a number is divisible by 2 , 3 or 6 using Switch Statement. Write a function

I cant figure thisGiven an integer N, find a number is divisible by 2,3 or 6 using Switch Statement.
Write a function solution that accepts an integer number N and returns a largest number among 2,3 and 6 by which N is divisible. If a number is not divisible by 2,3 or 6 then return -1.
Use switch statement.
Input4
Output
4 is divisible by 2. Not by 3 and 6.
 I cant figure thisGiven an integer N, find a number is

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!