Write the C++ to print the prime numbers between 100-200.
Answers
Answered by
2
#include<iostream>
#include<math.h>
using namespace std;
int main( ){
int c = 0;
for(int i = 100; i<200; i++){
c = 0;
for(int j = 2; j<=sqrt(i); j++){
if( i % j == 0 ){
c++;
break;
}
}
if ( c == 0 )
cout<< i <<endl;
}
}
#include<math.h>
using namespace std;
int main( ){
int c = 0;
for(int i = 100; i<200; i++){
c = 0;
for(int j = 2; j<=sqrt(i); j++){
if( i % j == 0 ){
c++;
break;
}
}
if ( c == 0 )
cout<< i <<endl;
}
}
Similar questions