64 730
Assignments Done
99,3%
Successfully Done
In September 2018

Answer to Question #19243 in C++ for fatima

Question #19243
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>
#include <stdlib.h>

using namespace std;

int main()
{

int a;
cin>>a;
if (a<0) cout<<"a<0& !!!";
if (a>0)& {
for(int i=1;i<=a;i++)
{ cout<<"a="<<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