0

How to check for prime numbers using only the for loop?

I have a task and i cannot do it. Please help.

1st Nov 2019, 7:06 PM
Zain Shah
Zain Shah - avatar
2 odpowiedzi
+ 3
Your constraint doesn't really make sense to me, you need to use some calculations and conditions too at least. If you need an algorithm to calculate primes, read a bit first and then try to design the logic of your program. https://en.m.wikipedia.org/wiki/Trial_division It is also advisable to put the programming language in the tag of your question, that way you can get more specific advice.
1st Nov 2019, 7:39 PM
Tibor Santa
Tibor Santa - avatar
0
You need to use an if statement inside the for loop.
1st Nov 2019, 7:39 PM
Avinesh
Avinesh - avatar