Q. Write a short program to check weather square root of a number is prime or not.
You can understand by Watching video :-
Answer :-
num = int(input("Enter a number = ")) import math a = int(math.sqrt(num)) b = 0 for i in range(2,a): if a % i == 0 : b = b + 1 if b == 0 : print(a, "Is a prime number ") else : print(a, "Is not prime number ")
Output :-
Enter a number = 49
7 Is a prime number
>>>
Enter a number = 625
25 Is not prime number
>>>
Enter a number = 144
12 Is not prime number
>>>
Post a Comment
You can help us by Clicking on ads. ^_^
Please do not send spam comment : )