Code:
##include <stdio.h>
#include <iostream.h>
int exponent (int, int);
void main()
{
int num;
int expo;
printf("Enter a number:");
scanf("%d", &num);
printf("Enter a exponent number:");
scanf("%lld", &expo);
printf("The answer is: %d\n", exponent(num, expo));
}
int exponent(int a, int b)
{
int sum=0;
int avg=1;
while (avg <b)
{
sum=sum*a;
avg++;
}
return sum;
}
This Code works 100% (it worked great for me)just make sure you just have to change the printf put cout<< and for scanf put cin>> dont forget that ok see yaa good lock