Write a C++ program to display all prime numbers between 100 and 200.
Answers
Answered by
0
Answer:
Time complexity O(n2)
#include<iostream>
using namespace std;
int main()
{
for(int i=100;i<=200;i++)
{
int c=0;
for(int j=2;j<i;j++)
{
if(i%j==0)
c++;
}
if(c==0)
cout<<i<<" ";
}
return 0;
}
Similar questions
English,
2 months ago
Math,
2 months ago
Chemistry,
2 months ago
Sociology,
5 months ago
Computer Science,
5 months ago
Computer Science,
10 months ago
Geography,
10 months ago