Skip to content

Instantly share code, notes, and snippets.

@DiegoNaterasPonce
Created April 19, 2016 16:03
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 DiegoNaterasPonce/57d8e5a2f970a54533908222052ce3c1 to your computer and use it in GitHub Desktop.
Save DiegoNaterasPonce/57d8e5a2f970a54533908222052ce3c1 to your computer and use it in GitHub Desktop.
#WSQ13 Exam2 Prog2
#include <iostream>
#include <iomanip>
using namespace std;
int superpower(int a, int b)
{
int z=1, number=1;
do {
number=number*a;
z=z+1;
}
while (z<=b);
return number;
}
int main () {
int n1, n2, x;
cout <<"Give me the first number: \n";
cin >> n1;
cout <<"Give me the second number: \n";
cin >> n2;
x=superpower(n1,n2);
cout <<"The result is: " <<x<<endl;
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment