Computer Science, asked by miniep63, 8 months ago

writte the program to display prime number below 100 in c++

Answers

Answered by gracy0402
1

Answer:

h" #include <math. h> #include <iostream> using namespace std; int main() { double rt; for (int d = 2, n = 2; n < 100; d = 2, n++) { for (rt = sqrt(n); d < rt; d++) if (n % d == 0) break; if (d > rt) cout << n << " "; } getchar(); // 25 primes :-) } Deleted an earlier answer with (like other answers) a prime-sieve.

Similar questions