Python Examples
2. Program to check whether the given number is prime or not.
n = int(input('Enter a value'))
i=1
count=0
while i<=n:
if n%i==0:
count = count+1
i=i+1
if count==2:
print('Prime')
else:
print('Not prime')
Input :
17
Output :
Prime
n = int(input('Enter a value')) i=1 count=0 while i<=n: if n%i==0: count = count+1 i=i+1 if count==2: print('Prime') else: print('Not prime')Input :
17
Output :
Prime
Father of Python Language