Write a program to accept a number from user, check and display the number given is prime or not. Print appropriate message .
Best answer will be marked brainliest... and please do not spam.
Language- Python
Answers
Answered by
1
Program in Python to check if entered No. is a Prime.
num = int(input("Enter a number: "))
count = 0
if (num < 2):
print("Enter a valid number")
else:
for i in range(1, num+1):
if (num % i) == 0:
count = count + 1
if count == 2:
print("Prime")
else:
print("Not Prime")
#program ends
Hope this helps !
Answered by
0
Write a menu driven program to accept a number and check and display whether it is a prime number or not OR an automorphic number or not. (Use switch- case statement) (a) Prime number: a number is said to be a prime number if it is divisible only by 1 and itself and not by any other number. Example : 3, 5, 7, 11, 13 etc., (b) Automorphic number: An automorphic number is the number which is contained in the last digit(s) of its square. Example 25 is an automorphic number as its square is 625 and 25 is present as the last two digits....
PLEASE FOLLOW ME FOR MY EFFORT AND MARK BRAINLIEST.....PLEASE THANK AND RATE
Similar questions