Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Written in C language please. In developing contingency plans to deal with critical failures, you can use a formula from probability theory that computes the

Written in C language please.

In developing contingency plans to deal with critical failures, you can use a formula from probability theory that computes the number of different ways which r items can be selected from a collection of n items without regard to order. The formula is written as (, ) = ! / ! ( )! This formula represents the number of different combinations of n items taken r at a time. For example, if a system has 5 components, all of which are connected to each other, how many possible sets of 2 failures at once are there? To answer this question, the following calculation would be carried out: (5,2) = 5! / 2! (5 2)! = 5! / 2! 3! = 120 / 2 6 = 10 The answer is 10 different pairs of component failures. Write a function that returns the factorial of a given integer. Use this function in a program that prompts a user to enter the total number of components in a system (n) followed by the number of components considered at a time (r). Use the equation above (with your function) to calculate the number of failure combinations (C).

Your display should be similar to the following: Enter the total number of components in this system> 11 Enter the number of components selected> 7 The total number of possible failure combinations is 330

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

Develop a program for effectively managing diversity. page 303

Answered: 1 week ago