Guidelines regarding the initial comment section

Assignment Help Basic Computer Science
Reference no: EM13859313

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. 

Reference no: EM13859313

Questions Cloud

Prepare a cms-pm projects on fitness revolution : Prepare a CMS/PM Projects on Fitness Revolution (Fitness Centre). The fitness centre wants to promote a women-friendly atmosphere with their young energetic personal trainers.
Describe circumstances under which retail inventory method : Determine the inventory as of December 31, 2014, by the lower-of-cost-or-market method, apply- ing this method directly to each item and prepare the journal entries required at December 31, 2013, and December 31, 2014, assuming that the inventory ..
Determine the estimated service demand load in volt-ampres : Determine the estimated service demand load in volt-ampres and amperes @ 240V for a residence having the following characteristics- 2500 sq ft
Prepare a cms-pm projects on bluesfest music festival : Prepare a CMS/PM Projects on Bluesfest Music Festival. Advertising festival sponsors (1 gold sponsor, 2 silver, and 3 bronze - Gold sponsors pay more and should have a bigger presence.
Guidelines regarding the initial comment section : Observe the usual guidelines regarding the initial comment section, indenting, and so on.  In addition,
What is the rate at which the entropy of the low-temperature : What is the rate at which the entropy of the low-temperature reservoir is changing. What is the rate at which the work production is changing the entropy of the engine surroundings
Variables does the data frame have : How many variables does the data frame have? How many rows does the data frame contain?
Homemakers are not included in the employment : Q#1. Homemakers are not included in the employment or labor force totals compiled by the Bureau of Labor Statistics household survey. They are included in the working-age population totals. Suppose that homemakers were counted as employed and include..
Homemakers are not included in the employment : Q#1. Homemakers are not included in the employment or labor force totals compiled by the Bureau of Labor Statistics household survey. They are included in the working-age population totals. Suppose that homemakers were counted as employed and include..

Reviews

Write a Review

Basic Computer Science Questions & Answers

  Compute the pipeline speed-up ratio

Given the datapath shown in, and the latencies above for the individual elements of the datapath, compare clock cycle time of the single-cycle.

  Function in programs to print upside down triangles

Apply function in programs to prints triangles, upside down triangles, and diamond.

  He set of binary strings which are divisible

The set of binary strings which are divisible by 4 when interpreted as an integer value.

  Design a finite state machine similar to a 3 bit counter

design a finite state machine similar to a 3 bit counter. in this case you will have 3 bits of state which you can think of as a 3 bit unsigned number, but this time the counter must count by 3s--the sequence it goes through should be 0, 3, 6, 1, ..

  Defend why technology is the best of the three

Submit a discussion in which you examine UBR, CBR and ABR technologies. Choose one of these as the preferred method for transmitting data when bit-rate and minimum quality of service are top priorities and defend why this technology is the best..

  Explain what is meant by information technology

Explain what is meant by information technology (IT). Explain what is meant by information systems (IS). Why is it important to understand the differences between information technology (IT) and information systems (IS)?

  How you configure an operating system interface with network

How do you configure an operating system to interface with a network

  Does standard unix operating system use nondiscretionary

Does the standard Unix operating system use a nondiscretionary access control? Explain your answer.

  What is the use of win32 console functions

What is the use of Win32 Console functions and how they relate and pertain to GUI.

  Different entities or objects, logical process

Different entities or objects, logical process, data flows, and data stores that are involved starting from the time of submitting a time sheet

  Traditional project management approach

Identify the business problems the project team tried to solve and analyze how they applied the agile project management techniques to ensure the project was delivered on time, on budget with good quality.

  Grown into a national chain with hundreds of locations

Habibi's has now grown into a national chain with hundreds of locations. Each location has one Windows Server 2008 and many Windows Vista desktop computers.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd