Advance Programs On For LoopLearn C ProgrammingLearn ProgrammingLoop Control StructuresResources

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

By September 18, 2012 February 5th, 2018 No Comments

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

DEMO01