Simple math in C++: Difference between revisions
wikademia>Nirdh added a sample program |
wikademia>Wikademia m moved Simple Math to Simple math in C++ |
||
| (2 intermediate revisions by 2 users not shown) | |||
| Line 86: | Line 86: | ||
---- | ---- | ||
<code><pre> | <code><pre> | ||
#include<iostream | #include<iostream> | ||
using namespace std; | |||
int main(){ | |||
int n; | |||
{ | cin>>n; | ||
for(int i=2;i<n;++i){ | |||
int count=0; | |||
for(int j=1;j<=n;++j) | |||
if(!(i%j)) | |||
++count; | |||
if(count==2) | |||
cout<<i<<endl; | |||
} | |||
return 0; | |||
} | } | ||
</pre></code> | </pre></code> | ||
---- | ---- | ||
==Where To Go Next== | ==Where To Go Next== | ||