Advertisement
hrustic_nihad

potencija_nekog_broja

Jan 16th, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.50 KB | None | 0 0
  1. #include<iostream>
  2. #include<iomanip>
  3. using namespace std;   
  4. void potencija(int);
  5. int main()
  6. {
  7. int broj;
  8.     cout << "Unesi broj :" << endl;
  9.     cin >> broj;
  10.  
  11.     potencija(broj);
  12.  
  13.     system("pause>0");
  14.     return 0;
  15. }
  16. void potencija(int br)
  17. {
  18.     int brojac = 0, x = br-1;
  19.     while (brojac == 0)
  20.     {
  21.         x++;
  22.         for (int i = 2; i < br; i++)
  23.         {
  24.             for (int j = 2; j < br; j++)
  25.             {
  26.                 if (pow(i, j) == x)
  27.                 {
  28.                     brojac++;
  29.                     cout << i << " ^ " << j << " = " << x << endl;
  30.                 }
  31.  
  32.             }
  33.         }
  34.     }
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement