Advertisement
idsystems

CPP_Practica55_SuperPrimos

Mar 13th, 2013
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.39 KB | None | 0 0
  1. // Program: sprimo.cc
  2. // Author:  Yoan Pinzon
  3. // Date:    Agosto 30, 2006
  4.  
  5. #include <iostream>
  6.  
  7. using namespace std;
  8.  
  9. int main(){
  10.    int n, c=0;
  11.  
  12.    cout << "Entre n: "; cin >> n;
  13.    for(int i=1; i<n; i++){
  14.       c=0;
  15.       for(int j=2; j<=sqrt(i); j++) if( i%j==0 ) c++;
  16.       if(!c) cout << (i<3?"[":"") << i << (i<3?"]":"")  << "-";
  17.    }
  18.    cout << "\b " << endl;
  19.  
  20.    return 0;
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement