Write a program to show the prime numbers from 1 to 100 | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 3

Write a program to show the prime numbers from 1 to 100

15th Apr 2017, 3:04 PM
Eli Baraka
Eli Baraka - avatar
4 Answers
+ 12
Give input as 100 to this code. https://code.sololearn.com/cx1fwlL103Es/?ref=app
15th Apr 2017, 3:13 PM
Krishna Teja Yeluripati
Krishna Teja Yeluripati - avatar
+ 11
https://code.sololearn.com/cMIpx9pnzVcn/?ref=app
15th Apr 2017, 3:36 PM
Sachin Artani
Sachin Artani - avatar
+ 1
Show me yours and I'll show you mine ;-) Here's what I used in my Python routine (I'll add the link later): - 2 is the only even prime. For the rest, you only need to check the odd numbers. - If a number is a square number like 3*3, 5*5, it is not prime - The highest divisor that you need to check cannot be higher than the square root of each number. There you go: https://code.sololearn.com/cQ03qEe16RQw
15th Apr 2017, 3:51 PM
Klaus-Dieter Warzecha
Klaus-Dieter Warzecha - avatar
+ 1
https://code.sololearn.com/cMC3JLRv0T04/?ref=app input: begin end example: for input string "4 120" program prints a prime numbers in range from 4 to 120.
4th Oct 2017, 4:33 PM
Вадим Сухотин (Vadim Sukhotin)
Вадим Сухотин (Vadim Sukhotin) - avatar