fork download
  1. #include <iostream>
  2. using namespace std;
  3. long double potencia(int, int);
  4. int main()
  5. {
  6. int x, y;
  7. // cout << "Introduzca base: ";
  8. cin >> x>>y;
  9. //do
  10. //{
  11. // cout << "Introduzca exponente >=0 : ";
  12. //cin >> y;
  13. //}while(y<0);
  14.  
  15. //cout << x << " elevado a " << y << " = "
  16. cout<< potencia(x,y) << endl;
  17. //system("pause");
  18. }
  19. long double potencia(int x, int y)
  20. {
  21. if (y==0)
  22. return 1;
  23. else
  24. return x*(potencia(x,y-1));
  25. }
Success #stdin #stdout 0s 16064KB
stdin
3 60
stdout
4.23912e+28