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
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
English,
5 months ago
Social Sciences,
5 months ago
Physics,
5 months ago
India Languages,
10 months ago
Math,
1 year ago