The factorial of a nonnegative integer n is written n!
(pronounced “n factorial”) and is defined as
follows:
n! = n · (n - 1) · (n - 2) · … · 1 (for values of n greater
than to 1)
and
n! = 1 (for n = 0 or n = 1).
For example, 5! = 5 · 4 · 3 · 2 · 1, which is 120. Use while
structures in each of the following:
a) Write a program that reads a nonnegative integer and
computes and prints its factorial. Use the
following function prototype to calculate factorial:
int myFactorial(int n);
b) Write a program that estimates the value of the
mathematical constant e by using the formula:
Use the following function prototype to calculate e:
double myE( );
Hint: Use an accuracy of 10 terms.
c) Write a program that computes the value of ex by using
the formula
Use the following function prototype to calculate e:
double myEx(int x);
Answer Posted / wew
The factorial of a nonnegative integer n is written n!
(pronounced �n factorial�) and is defined as
follows:
n! = n · (n - 1) · (n - 2) · � · 1 (for values of n greater
than to 1)
and
n! = 1 (for n = 0 or n = 1).
For example, 5! = 5 · 4 · 3 · 2 · 1, which is 120. Use while
structures in each of the following:
a) Write a program that reads a nonnegative integer and
computes and prints its factorial. Use the
following function prototype to calculate factorial:
int myFactorial(int n);
b) Write a program that estimates the value of the
mathematical constant e by using the formula:
Use the following function prototype to calculate e:
double myE( );
Hint: Use an accuracy of 10 terms.
c) Write a program that computes the value of ex by using
the formula
Use the following function prototype to calculate e:
double myEx(int x);
| Is This Answer Correct ? | 14 Yes | 16 No |
Post New Answer View All Answers
Hello, I need to compare, using a cobol program, two cobol skeletons. I don't know if it is easy to do this or it will be so complicated. I wanna have your opinions. Thanks a lot
Tell me about a time when you had too many things to do and you were required to prioritize your tasks
please tell me difference between router and cisco router
i have passed my gRaduation in BCA and now im looking for post graduation from Germany, i haver passed my ielts wth 6 band, nw plz tell me some question that wll ambessay ask
A short CI column of hollow circular section has projecting bracket carrying a load of 10 tonnes. The load line is off the column by 20cm. The external diameter of the column is 350mm and thickness of metal is 25 mm. Find the maximum stress intensity in the section.
HELLO EVERYONE ON YAHOO , I'M IN NIGERIA AND I Will LIKE TO MOVE AND WORK IN CANADA , ANY SKILLED WORK IS OK BY ME AND THE PERSON WILL PAY THE BILL FOR IT, I WILL SERVE THE PERSON FOR THE EXPENSES.......... LOVE TO READ FROM YOU SOONEST AS YOU WISH TO HELP ME OUT
please explane me clusterd and non clusterd
successful command to make linux system as router in redhat-+
i want to know about the scope of IT engineers in ONGC
What would you like to discuss? Your work-ex or Your Engineering?
Anyone have thesis paper about "Electrical Load Forecasting" . Or the web addresses where people usually upload their thesis paper except IEEE.
How do you reset or reseed the IDENTITY column?
what are the artifacts in coding phase in SDLC????
how to connect oracle with java ? Give detail explanation.
I am student pursuing B.E/B.tech in Computers 8'th sem.What should i do for a better carrier.Plz suggest other than programming languages.Is the ERP a better one to do?plz help...