Write a program to check a number whether it is prime or composite.
aashish504:
please give answer
Answers
Answered by
2
Algorithm:
- Accepting the number.
- Checking the number is a prime number or not by iterating halfway to the number and checking if any number in that range is divisible by the number.
- If it is divisible then returns false else true.
- Finally displaying the output based on the value returned by the method.
Attachments:
Similar questions
English,
2 months ago
Math,
2 months ago
Math,
4 months ago
History,
4 months ago
Chemistry,
10 months ago
Social Sciences,
10 months ago
Social Sciences,
10 months ago