Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Computer Engineering Expert

Observe the usual guidelines regarding the initial comment section, indenting, and so on.  In addition,

  • In if-else statements, indent statements to be executed for if or else condition three spaces.  Align else or else if with corresponding if.
  • Indent statements within loops.  Indent nested loops.

1.   Write a program to find the approximation of ln(2) using the following formula for m+1 terms:

419_program to find the approximation.jpg

Prompt the user to enter the number of terms (between 10 and 50 inclusive) to be used in the approximation.  Use a while validation loop to assure that the number of terms is in the proper range.  Use a for loop to calculate each term in the sum and while doing so, to print a table.  Each line of the table should include the term (value of n) number, the value of the term added to the sum at that iteration accurate to 5 decimal digits, and the value of the sum at that iteration also printed with 5 decimal digits.  If there are 20 terms, they will be numbered 0 through 19.  Use doubles for the term and sum approximation values.  At the end of the program print the final value of the sum and also the actual value of ln(2) from the C library using 5 decimal digits. 

2.  Write a program to calculate the factorial of a number.  The factorial n! of a positive number (integer) is defined by n! = n*(n-1)*(n-2)*...*3*2*1, where 0! = 1.

In function main prompt the user for a non-negative integer less than 20 for which the factorial is to be found.  Use a while validation loop to assure the number entered is in the proper range.  Then call a function to calculate the factorial.  The input to the function is the integer n and the return value is n factorial.  Use data type double for the factorial.  In the function use a for loop to calculate the factorial.  Make provision for the situation in which n = 0.  Return the value of n factorial to function main and print.  Test with n = 14. 

Computer Engineering, Engineering

  • Category:- Computer Engineering
  • Reference No.:- M91520074
  • Price:- $40

Priced at Now at $40, Verified Solution

Have any Question?


Related Questions in Computer Engineering

Espn pays the nfl 11 billion per year for 8 yrs for the

ESPN pays the NFL $1.1 Billion per year for 8 yrs for the right to exclusively televise football. What is the NPV of the investment if the parent Disney CO has an opportunity interest rate that is equal to the cost of ca ...

Suppose that we reconsider our student example and the only

Suppose that we reconsider our STUDENT example and the only attributes of STUDENT are student number and name. Let us suppose that we have another entity called HIGH SCHOOL, that is going to be the high school from which ...

Assignment - review of article where physical security

Assignment - Review of Article Where Physical Security Failed • Search the Internet for an article where physical security failed • Propose a possible change in that organization's physical security that could have preve ...

Alpine company stock is selling for 3240 a share one 30

Alpine Company stock is selling for $32.40 a share. One $30 call is valued at $2.76 and one $29 put is valued at $.65. What is the value of three call option contracts (remember that one contract includes 100 options)?

In statistics the mode of a set of values is the value that

In statistics, the mode of a set of values is the value that occurs most often or with the greatest frequency. Write a function that accepts as arguments the following: A. An array of integers B. An integer that indicate ...

Systems analysis assignment can you answer the 4 questions

Systems Analysis assignment : Can you answer the 4 questions please? Continuing Case: Personal Trainer, Inc. Personal Trainer, Inc. owns and operates fitness centers in a dozen Midwestern cities. The centers have done we ...

What is the lithium by mass in a sample of pure lithium

What is the % lithium by mass in a sample of pure lithium carbonate that has a sample size of 10.0g?

Question as we have seen traditional and agile schedule

Question : As we have seen, traditional and Agile schedule developments are quite different. Agile project management was originally developed to do software development. Could a traditional process be successfully used ...

Hemophilia is a hereditary disease for females it is known

Hemophilia is a hereditary disease for females. It is known that any female has 40% chance of being a carrier of hemophilia. If the mother was a carrier, then any daughter of hers has 50% chance of inheriting this diseas ...

Shading and illuminating algorithmsa explain in your own

Shading and illuminating algorithms. a) Explain, in your own words, how the Phong illumination model works and what its strong and weak features are. b) Compare flat and Gouraud shading algorithms.

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As