Hi there,
I've made a basic code for solving exponents:
When I run it, strangely the value of output is less by '1' than the correct one. Now this can be easily taken care of by the 'c = c+1' equation. But, where did that '1' go?Code:#include <stdio.h> #include <math.h> /*exponent*/ int main () { int a,b,c; printf("Format: a^b\n"); printf("Enter a and b\n"); scanf("%d%d", &a, &b); c = exp(b*log(a)); c = c+1; /*WHY???*/ printf("%d", c); return 0; }