Programming Examples

Python program to check whether square root of a given number is prime or not


WAP to check whether square root of a given number is prime or not.

Solution

import math
n=int(input("Enter a number "))
m=int(math.sqrt(n))
k=0
for i in range(2,m//2+1):
    if m%i==0:
        k=k+1
if k==0:
    print(m,", which square root of ",n," , is Prime Number.")
else:
    print(m,", which square root of ",n," , is NOt Prime Number.")
Output/ Explanation:


Latest Current Affairs 2024 Online Exam Quiz for One day Exam Online Typing Test CCC Online Test Python Programming Tutorials Best Computer Training Institute in Prayagraj (Allahabad) Online MBA 2 years Online MCA Online BCA Best Website and Software Company in Allahabad