#include<iostream.h>

#include<conio.h>

#include<math.h> //for pow() function

#include<conio.h>

#include<math.h> //for pow() function

void main()

{

clrscr();

int x,n,res;

cout<<“Enter value of x and n:”;

cin>>x>>n;

res=pow(x,n);

cout<<“nResult=”<<res;

getch();

}

it fails for powers of 5 as it gives 5^2=24 always 1 less than the output

no, I don’t think it should. This program works for any value of x and n. Also, I think it should be “nResult” or simply “Result” and not just “nResult”.

Thanks A lot