orlandoju

Ejer16_tp3

Apr 16th, 2022
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.53 KB | None | 0 0
  1. //Nombre:
  2. //TP N°:
  3. //EJ N°:
  4. // Comentarios:
  5.  
  6. #include <iostream>
  7. using namespace std;
  8.  
  9. int main(void){
  10.  
  11.     int i,j;
  12.  
  13.  
  14.     for (i=2; i<=100; i++)
  15.     {
  16.         int cont=0;
  17.  
  18.         for(j=2; j<=100; j++)
  19.         {
  20.             if(i%j==0)
  21.             {
  22.                 cont=cont+1;
  23.             }
  24.         }
  25.         if(cont==1)
  26.             {
  27.             cout<<"--"<<i<<"--"<<endl;
  28.             }
  29.     }
  30.  
  31.         /*if(cont==1){
  32.             cout<<num<<endl;
  33.          cont=0;
  34.          }*/
  35.  
  36.  
  37.  
  38.  
  39.     return 0;
  40. }
  41.  
Advertisement
Add Comment
Please, Sign In to add comment