To print all the prime numbers up to N, we start one loop from 2 to N and then inside the loop we check current number or “num” is prime or not.
確定! 回上一頁