(a) Write a program in C++ to print the prime numbers between 100-200.
Answers
Answered by
1
Answer:"The program in C++ programming language that will print the prime numbers between 100 and 200 is as follows:
#include <iostream>
using namespace std;
int main()
{
int low = 100;
cout << "Prime numbers between " << 100 << "and " << 200 << " are: ";
while (low < 200)
{
flag = 0;
for (i = 2; i <= low/2; ++i)
{
if(low % i == 0)
{
flag = 1;
break;
}
}
if (flag == 0)
cout << low << " ";
++low;
}
return 0;
}"
Similar questions