65 865
Assignments Done
99,1%
Successfully Done
In October 2018

Answer to Question #15308 in C++ for Me

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

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions