Skip to content

Instantly share code, notes, and snippets.

@batmantec
Created February 5, 2016 18:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save batmantec/3dbd1fde9e5bf46899cd to your computer and use it in GitHub Desktop.
Save batmantec/3dbd1fde9e5bf46899cd to your computer and use it in GitHub Desktop.
#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