Answer to Question #15308 in C++ for Me
Write a program that outputs all prime numbers less than 1000
1
2012-09-27T10:27:45-0400
#include<iostream.h>
#include<stdlib.h>
#include<ctype.h>
bool is_simple(int count){
for(int i =2; i < count; i++){
& if(count % i == 0)
return false;
}
return true;
}
void main(){
for (int i=1;i<1001;i++)
& if (is_simple(i)) cout<<i<<"\n";
}
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