Answer to Question #15308 in C++ for Me

Question #15308
Write a program that outputs all prime numbers less than 1000
1
Expert's answer
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!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
APPROVED BY CLIENTS