60 463
Assignments Done
98,1%
Successfully Done
In April 2018

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
#include<iostream>
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;
& }
}
system("pause");
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!

Comments

No comments. Be first!

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions