Advertisement
pan7nikt

potegaLiczby

Feb 18th, 2020
378
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.42 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. float a;
  5. float b;
  6.  
  7. float sqr(float a, float b)
  8. {
  9.     int i;
  10.     float wynik = 1;
  11.    
  12.     for(i=0;i<b;i++)
  13.     {
  14.         wynik = wynik * a;
  15.     }
  16.     return wynik;
  17. }
  18.  
  19. main ()
  20. {
  21.     cout << "Potege jakiej liczby chcesz uzyskac: ";
  22.     cin >> a;
  23.     cout << "Do ktorej potegi chcesz ja podniesc: ";
  24.     cin >> b;
  25.     cout << "Liczba " << a << " podniesiona do potegi " << b << " wynosi: " << sqr(a,b) << endl;
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement