Advertisement
Guest User

ArrayPrime.cpp

a guest
Apr 8th, 2020
212
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.43 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. bool isPrime( int n ){
  6.       for( int i=2; i< n; i++ ) {
  7.          if( n % i == 0 ) {
  8.             return false;
  9.          }
  10.       }
  11.       return true;
  12. }
  13.  
  14. int main()
  15.  
  16. {
  17.  
  18.    int Primes[100];
  19.  
  20.    int currentcheck;
  21.    int primeamount;
  22.  
  23.    while ( Primes!=100 )
  24.    {
  25.       for ( int i=1; i<=Primes; i++ )
  26.  
  27.          if ( isPrime(i) ) cout<<i<<endl;
  28.  
  29.    }
  30.  
  31.    return 0;
  32.  
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement