C Program To Find Exponent Power Series

C Program To Find Exponent Power Series

#include<stdio.h>
#define ACC 0.0001

int main()
{

   int n, count;
   float a, term, sum;

   printf("Enter value of a :\n");
   scanf("%f", &a);   //input from user

   n = term = sum = count = 1;

   while (n <= 100)
   {
      term = term * a / n;
      sum = sum + term;
      count = count + 1;

      if (term < ACC)
         n = 999;
      else
         n = n + 1;
   }

   printf("Terms : %d\n Sum : %f\n", count, sum);   //Print Output On screen

}

Copyright © C Program | Java | OpenGL Programming | Hadoop at Computaholics