Answer to Question #19243 in C++ for fatima
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
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!
Learn more about our help with Assignments:
C++
Comments
Leave a comment