Advertisement
alias3glw

Potencia 3

Jun 8th, 2015
448
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.37 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3. void potencia (void);
  4. int i;
  5. double x,y,base,exp;
  6. main() {       
  7.     potencia();
  8. }
  9. void potencia(void){
  10.     double resultado=1;
  11.     cout<<"Ingrese la base: ";
  12.     cin>>x;
  13.     cout<<"\nIngrese la Potencia: ";
  14.     cin>>y;
  15.     for (i=1;i<=y;i++){
  16.         resultado=resultado*x; 
  17.     }
  18.     cout<<"La "<<y<<" potencia de "<<x<<" es "<<resultado<<endl;   
  19.    
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement