Advertisement
Guest User

ohyes

a guest
Oct 13th, 2015
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.29 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main (){
  5.     int i, a, cont;
  6.     i = 1;
  7.    
  8.    
  9.     while (i <= 100){
  10.         a = 1;
  11.         cont = 0;  
  12.         while (a <= i){
  13.             if (i%a == 0){
  14.             cont++;
  15.             }                                      
  16.             a++;       
  17.             }
  18.         if (cont== 2){
  19.             cout<<" "<< i <<" "<<endl;
  20.             }
  21.            
  22.         i++;
  23.     }
  24.    
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement