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


Online Exam Quiz for One day Exam Online Typing Test CCC Online Test 2026 Best Computer Training Institute in Prayagraj (Allahabad) Best Java Training Institute in Prayagraj (Allahabad) Best Python Training Institute in Prayagraj (Allahabad) O Level Online Test in Hindi Best Website and Software Company in Allahabad