052. Write a program to accept a number n from user and Add n terms of the series in C language

1/2! + 2/3! + 3/4! + 4/5! + 5/6! + ………

 
#include<stdio.h>
#include<conio.h>
main()
{
	int i,j,n;
	float sum=0,fact=1;
	clrscr();
	printf("Enter number....");
	scanf("%d",&n);
	for(i=1;i<=n;i++)
	{
		fact=1;
		for(j=1;j<=i+1;j++)
			fact=fact*j;
	sum=sum+i/fact;
	}
	printf("Sum of the series....%f",sum);
	getch();
}

Leave a Reply

Your email address will not be published. Required fields are marked *