76 775
Assignments Done
Successfully Done
In June 2019

Answer to Question #19374 in C++ for madridi

Question #19374
Write a program that asks the user to enter a positive number then displays all numbers less or equal to it that are prime.
Expert's answer
using namespace std;
int main ()
int num, a;
cout << "Enter A Positive integer :"<<endl;
cin >> num;
cout<<" The Prime numbers are: " ;
for(int i = 2; i < num; i++){
& if(i%2!=0){
& cout << i <<endl;
& }
return 0;

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!


No comments. Be first!

Leave a comment

Ask Your question

Privacy policy Terms and Conditions