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
5S training documents
what is means of admistrative distance
sir ,,kindly provide me 10 year old solved question papers of gate ,i am from CS. branch...
what is the difference between oracle 8i vs 9i
what is the working of tcp/ip?
What a test plan contains
Are bridges more stable on concrete or on soil - why?
How To Servers For Malitnationl Bank?
how much the percentile as a good percentile in elitmus.
How to work Air cooled and water cooled chiller?
THESE POSTS ARE FOR THE DURATION OF FIVE YEARS. AFTER COMPLETION OF FIVE YEARS, THE PERSONNEL POSTED AGAINST THESE POSTS ARE LIKELY TO BE CONTINUED IN NIC. CAN Any body say that what it will be happened after 5 years? does they through us out from NIC? Is it a temporary job of 5 years is the probation period?
what is program data insulation in dbms?
real time examples for basic concepts in oop
what is the difference between physical address and logical address?
what is the difference between oracle 8i and 9i. if someone could help me out.