Skip to content

Instantly share code, notes, and snippets.

@batmantec
Created February 5, 2016 18:26
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
#include <iostream>
using namespace std;
int superpower(int x, int y){
int ox, save, count=1;
ox=x;
do {
save=x*ox;
x=save;
count++;
} while(count!=y);
return save;
}
int main(){
int ox,x,y,count,save;
cout<<"This program calculates the exponential"<<endl;
cout<<"What is the number what you want to raise? ";
cin>>x;
cout<<"What is the exponential number? ";
cin>>y;
save=superpower(x,y);
cout<<"The exponential number is: "<<save;
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment