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-26T06:07:07-0500
#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; }
Numbers and figures are an essential part of our world, necessary for almost everything we do every day. As important…
APPROVED BY CLIENTS
"assignmentexpert.com" is professional group of people in Math subjects! They did assignments in very high level of mathematical modelling in the best quality. Thanks a lot
Comments
Leave a comment