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.
1
Expert's answer
2012-11-22T09:43:48-0500
#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 the first!

Leave a comment

LATEST TUTORIALS
APPROVED BY CLIENTS