All Prime Numbers
All Prime Numbers
Send Feedback
All Prime Numbers
Integer N
Prime numbers in different lines
1 <= N <= 100
9
2
3
5
7
20
2
3
5
7
11
13
17
19
#include <iostream>using namespace std;
int main(){ int n; cin>>n; for(int i=2; i<=n; i++){ int isPrime = 1; for(int j=2; j<i; j++){ if(i%j == 0){ isPrime =0; break; } } if(isPrime){ //isPrime == true cout<<i<<endl; } }}
Comments
Post a Comment