Advertisement
Guest User

Untitled

a guest
Apr 4th, 2020
1,164
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.27 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. bool bilprima (int a) {
  5.     if(a==2) {
  6.         return true;
  7.     }
  8.    
  9.     for(int b=2;b<a;b++) {
  10.        
  11.         if(a%b==0)
  12.         return false;
  13.     }  
  14.     return true;
  15. }
  16.  
  17. int main() {
  18.     for(int i=2;i<=100;i++) {
  19.         if(bilprima(i)) cout << i << endl;
  20.     }
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement