{

int index;

int result;

result = 1;

for (index = 0; index < n; index++)

result = result* x;

return(result);

}

/* To calculate m^e mod n */

answer = power(m, e) % n;

No headers are necessary.

This assumes that e is positive.

If you use large numbers you will have to use larger variable types, e.g. long.