Write a program to calculate the factorial of a number

Assignment Help Computer Engineering
Reference no: EM132155889

Use C only not C++

and write a little describtion to each step

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 negative integer less than 15 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: EM132155889

Questions Cloud

What is the probability that mike and joe : What is the probability that Mike and Joe will be playing against each other? How would I start working this?
Find the probability that the resulting number : Four cards with digits 0, 1, 2 and 3 are rearranged in random order. Find the probability that the resulting number will be greater than 2018.
Write a loop to find the sum of all integers from m : Write a loop to find the sum of all integers from m through n. For example, if m is 4 and n is 7, this sum is 4+5+6+7 = 22.
What is the probability that the outcome : A fair die is rolled twice; What is the probability that that the outcome of the second roll is greater than the outcome of the first roll?
Write a program to calculate the factorial of a number : Call a function to calculate the factorial. The input to the function is the integer n and the return value is n factorial.
What is the purpose of activity diagram : How is use case diagram related to functional modeling? How does an essential use case differ from a real use case?
What is the lower limit of the interval : Terrance want to find a 95% confidence interval for the true proportion of the population who favor the bill. What is the lower limit of the interval?
Write in pseudo-code the siftdown algorithm for a min-heap : A ternary max-heap is similar to the binary max-heap that we have discussed in class, but now non-leaf nodes can have 3 children instead of 2.
What are the indices of the parent and children of a node : A ternary max-heap can be represented using an array. What are the indices of the parent and children of a node at index i ?

Reviews

Write a Review

Computer Engineering Questions & Answers

  You are the communications coordinator for a national drug

you are the communications coordinator for a national drug manufacturer. recently there have been reports of

  Write a cpu class that has one member function

Write a CPU class that has one member function, ‘Execute,' which simply gets called to execute the process.

  Discuss the key components or aspects of cyber domain

A definition of the cyber domain and its key components or aspects. The cyber domain encompasses cybersecurity, a discipline that involves the following.

  Discuss governance of information within organizations

Examine the principles requiring governance of information within organizations

  Draw the timing diagram for the given outputs

Shown below is a 3-bit counter made up of negative edge-triggered JK flip-flops. Draw the timing diagram for outputs QA, QB, and QC in respect with the clock.

  Build a model to forecast the outcomes of the table events

Build a model to forecast the outcomes of one of the following types of be table events, and rigorously analyze it through back testing.

  Resolving the ambiguities in the software

Describe what you must do in such a situation. You know that cost to your current employer will increase in case the ambiguities are not resolved. Though, you have also a responsibility of confidentiality to your previous employer.

  Write an application to pre-sell a limited number of tickets

Write an application to pre-sell a limited number of cinema tickets. Each buyer can buy as many as 4 tickets. No more than 100 tickets can be sold.

  Design a combinational verilog module

The starter code from the course web page includes test benches for each problem below. For each of the following, please submit the source code for your Verilog module along with a printout or screen capture of waveform plots indicating a success..

  What options could you suggest to the club for different way

What options could you suggest to the club for different ways a report could be presented? Does your class diagram have the information readily available?

  Is it not the original owner error by not being more secure

If someone has not properly secured some important data, is it ethical for another person to exploit that situation and take the information? Is it not the original owner's error by not being more secure

  Create a program to find the number of intersecting pairs

Create a program to find the number of intersecting pairs among a set of N random lines, each line generated with random integer coordinates between 0 and 1000.

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