basically i have to do a summation of e, which is 1/k! and i need to allow the user to input a positive integer which i did. The second thing i need to do is once the total is given, i need to allow the user to enter another value or hit the return key to end the program. I know this has something to do with the getchar() function but i don't quite understand what to do.

The while(user>100); i put in temporary until i got the getchar() to work

Code:

#include <stdio.h>
#include <math.h>
#include <stdlib.h>
main()
{
double total,f;
int n,user,c;
printf("This program will take the the summations of 1/k! \n");
printf("from zero to upper limit entered by the user\n\n");
{
do
{
printf("Please enter a postive integer:");
scanf("%d ",&user);
if (user>0){
for(n=1,f=1,total=0;n<=user;++n)
{
f=f*n;
total = total + (1/f);
}
printf("\nThe total of the summation is: %f\n\n",1+total);
}
else
printf("Please enter a positive integer");
break;
printf("If you wish to quit, hit 'enter', if not type any other key\n");
}while(user>100);
getchar();
}
}