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


CCC Online Test Python Programming Tutorials Best Computer Training Institute in Prayagraj (Allahabad) Online Exam Quiz O Level NIELIT Study material and Quiz Bank SSC Railway TET UPTET Question Bank career counselling in allahabad Best Website and Software Company in Allahabad Website development Company in Allahabad