Advertisement
Josif_tepe

Untitled

Mar 8th, 2023
696
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.52 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main(){
  5.     int x;
  6.     cin >> x;
  7.    
  8.     if(x % 2 == 1) {
  9.         int deliteli = 0;
  10.         for(int i = 1; i <= x; i++) {
  11.             if(x % i == 0) { // ako ostatokot pri delenje na x so i ni e ednakov na 0, toa znaci deka brojot i e delitel na x
  12.                 deliteli++;
  13.             }
  14.         }
  15.         if(deliteli == 2) {
  16.             cout << "brojot e prost" << endl;
  17.         }
  18.         else {
  19.             cout << x << endl;
  20.         }
  21.     }
  22.     return 0;
  23. }
  24.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement