Computer Science, asked by vedantagrawala8679, 10 months ago

Use the switch statement write a menu driven program to check and display whether a number input by the user is a composite number or not​

Answers

Answered by devikamj5rv
1

Answer:

prime no. or not. (SORRY I COULD NOT GET THE ANS FOR THE COMPOSITE NO. I THINK THIS MIGHT HELP YOU)

Explanation:

int n=Integer.parseInt(br.readLine());

//input the number in variable 'n'.

int c=o;

for (int a=1;a<=n;a++)

{if(n%a==0)

c++;}

if(c==2)

System.out.println(n+"is a prime no.");

Similar questions