The following example code computes the sum of 1+4(3+3^2+3^3+3^4+...+3^N) series using pow() family of standard math library.
#include <stdio.h>
#include <math.h>
#include <errno.h>
#include <fenv.h>
int main()
{
double pwr, sum=0;
int i, n;
...