+ 1

error in this program

num=int(input("Enter any number")) lin=int(num/2)+1 for i in range (2,lim): rem=num%i if rem==0: print("number entered by you is not a prime number",num) break else : print (num,"number entered by you is a prime number")

6th Sep 2018, 3:17 PM
ayush
ayush - avatar
4 Answers
+ 3
It seems to me at first sight that the the names of the variables on line 2 and line 3 are different => lim and lin .
6th Sep 2018, 3:27 PM
TheWh¡teCat 🇧🇬
TheWh¡teCat 🇧🇬 - avatar
+ 2
Your second line should start with ‘lim’ but you have a typo and it currently says ‘lin’.
6th Sep 2018, 3:25 PM
Russ
Russ - avatar
+ 1
you replace the lin variable to lim in for loop.
6th Sep 2018, 4:02 PM
Maninder $ingh
Maninder $ingh - avatar
0
also, int declaration on line 2 is not needed
7th Sep 2018, 5:43 AM
Markus Kaleton
Markus Kaleton - avatar