Advertisement
Trollkemada

Untitled

Mar 13th, 2012
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.42 KB | None | 0 0
  1. float elevar(float base, int exponente) {
  2.       if (exponente == 0) {
  3.           if (base == 0 ) {
  4.               printf("Indeterminacion: 0^0");
  5.               return 1;
  6.           }
  7.           else {
  8.                return 1;
  9.           }
  10.       }
  11.       else if (exponente > 0) {
  12.            return base*elevar(base,exponente-1);
  13.       }
  14.       else if (exponente<0) {
  15.            return 1/elevar(base,-exponente);
  16.       }
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement