From cc1e0c6c868df5544c6b3b05ca96d188dcc094df Mon Sep 17 00:00:00 2001 From: Komal Gupta Date: Tue, 25 May 2021 12:39:04 +0530 Subject: [PATCH 1/3] Create factorial.cpp --- factorial/factorial.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 factorial/factorial.cpp diff --git a/factorial/factorial.cpp b/factorial/factorial.cpp new file mode 100644 index 0000000..9331c8e --- /dev/null +++ b/factorial/factorial.cpp @@ -0,0 +1,14 @@ +#include +//to find factorial +void main() +{ + long int num,a=1,i; + printf("Enter the no to find the factorial"); + scanf("%d",&num); + for(i=1;i Date: Tue, 25 May 2021 13:39:33 +0530 Subject: [PATCH 2/3] Rename factorial.cpp to factorial.c --- factorial/{factorial.cpp => factorial.c} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename factorial/{factorial.cpp => factorial.c} (100%) diff --git a/factorial/factorial.cpp b/factorial/factorial.c similarity index 100% rename from factorial/factorial.cpp rename to factorial/factorial.c From 9c691d2bcf4c2dcc069574175c81d2ebed42ad9f Mon Sep 17 00:00:00 2001 From: Komal Gupta Date: Tue, 25 May 2021 14:15:16 +0530 Subject: [PATCH 3/3] Create factorial_sum.c --- factorial/factorial_sum.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 factorial/factorial_sum.c diff --git a/factorial/factorial_sum.c b/factorial/factorial_sum.c new file mode 100644 index 0000000..34d6b3f --- /dev/null +++ b/factorial/factorial_sum.c @@ -0,0 +1,16 @@ +//sum of seven terms of factorial +#include +void main() +{ + double fact=1,res=0; + int i,n; + printf("To calculate the sum of series 1/1!+2/2! ..till n/n! \n "); + printf("Enter value of n\n"); + scanf("%d",&n); + for(i=1;i<8;i++) + { + fact=fact*i; + res+=i/fact; + } + printf("the sum of series 1/1!+2/2! ..till n/n! is %lf",res); +}