Search This Blog

Translate

c program to calculate series (1/1!)+(1/3!)+---+(1/n!)=n

c program to calculate series (1/1!)+(1/3!)+---+(1/n!)=n

#include"stdio.h"
#include"conio.h"
void main()
{
float no,i,no1,fact,ans=0;
clrscr();
printf("(1/1!)+(1/3!)+---+(1/n!)=\n");
printf("\n Enter the limit=");
scanf("%f",&no);
for(i=1;i<=no*2;i=i+2)
{
no1=i;
fact=1;
while(no1>0)
{
fact=fact*no1;
no1--;
}
ans=ans+(1/fact);
}
printf("\n\n Result of series is= %.4f",ans);
getch();
}





c program to calculate series (1/1!)+(1/3!)+---+(1/n!)=n

C Program example List

Google+ Badge