In: Computer Science
#include <stdio.h>
#include <math.h>
int fun(int);
int main(void)
{
int i = 5, x = 3;
i = fun(x);
printf("%d\n", i);
return 0;
}
int fun(int i)
{
int res = 0;
res = pow (i , 3.0);
return ( res);
}
Hi, since there is nothing mentioned as what to do with this code so I'm assuming that you want the output of this code. So for that I'm attaching the snippets of the code and it's output. The output of this code is 27.
The value of x is 3 and that 3 is passed as input when the function fun is called in line 7. Pow function is used to calculate the power. So the power of 3 will be 27 so the value of res will be 27 and that value will be return from the function. And hence that value will be stored in the variable i as the output from the function call. So the printed output will be 27 and not 5 which was the intially defined value of x.