1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Neko [114]
3 years ago
12

Write a function called committee to compute the number of ways of forming a single committee with r members from a collection o

f n people. This is the same as computing the number of ways of choosing r people out of n to sit at the first of two tables, and is therefore n! / (r!*(n-r)!). Make sure the function returns an integer, not a floating point number with a decimal point.

Computers and Technology
1 answer:
andrezito [222]3 years ago
5 0

Answer:

This program is written in C++.  The explanation of the code is given below in the explanation section.

Explanation:

#include <iostream>

using namespace std;

//factorial calculation

int fact(int n) {

  if (n == 0 || n == 1)

     return 1;

  else

     return n * fact(n - 1);

}

int main() {

  int n, r, comb; /* n represent number of people (population), r represent the number of selection from population and combination represent number of ways or combination */

  cout<<"Enter n : ";// prompt user to enter population i.e. total number of people

  cin>>n;//store into n

  cout<<"\nEnter r : ";//prompt user to enter number of selection from population

  cin>>r;

  comb = fact(n) / (fact(r) * fact(n-r));// calcuate combination- number of differnt ways to form a committe

  cout << "\nCombination : " << comb; //show the result

  return 0;

}

You might be interested in
Debug the program so it prints the factorial of a positive integer entered by the user. This is calculated by multiplying all th
Monica [59]

Your main problem was declaring int prod in the while loop. This caused prod to be reset back to 1 every time the while loop ran.

3 0
3 years ago
What are the atoms in grp one? periodic table. I am going to mark as brainliest ​
Maru [420]

Answer:

Atoms in group 1:

H

Li

Na

K

Rb

Cs

Fr

3 0
3 years ago
Given two int variables distance and speed, write an expression that divides distance by speed using floating point arithmetic,
Vsevolod [243]

Answer:

float(distance) / speed

Explanation:

Given the variable <em>distance</em> and <em>speed</em> in a program that hold a integer value respectively.  We can perform the division between the two variable using / operator. Since both distance and speed are integers, we need to convert one of them to float type to perform the floating point arithmetic. Otherwise the division output will be rounded up to the nearest integer which is not a desired result.

7 0
4 years ago
Pros and cons of toyota's organizational structure?
GarryVolchara [31]
In 2013, Toyota changed its organizational structure from the centralized structure to: 
- the Global hierarchy, 
- the Geographic divisions, and 
- the Product-based divisions. 

This change was made to adapt the consumer's demand in each of the regional markets all over the world. The most important element of this structure is the speed of handling issues and problems of all Toyota's branches. However, this structure also has a weakness which is the decreasing of headquarter's control over the global organization.
4 0
4 years ago
4.2 code need help plz someone 15 points if u help
Korolek [52]

def func():  

 total = 0

 while True:

   pet = input("What pet do you have? ")

   if pet == "rock":

     return

   total += 1

   print("You have a {} with a total of {} pet(s)".format(pet, total))

func()

We wrapped our code in a function so that whenever the user enters rock, we can simply return and exit the function. If you have any other questions, I'll do my best to answer them.

8 0
3 years ago
Other questions:
  • Mobile providers can be susceptible to poor coverage indoors as a result of: a high degree of latency. network congestion that c
    8·1 answer
  • 9) If you are working on the part of 5-15 minutes, time-stamping (every 30 seconds) should start at: a) [00:05:00] b) [00:00:00]
    9·1 answer
  • True or False. A modern programming EXE provides a text editor, a file manager, a compiler, a linker and loader, and tools for d
    9·1 answer
  • If you have created a document that contains a table that is 10 inches wide and 4 inches high, you will want to print the docume
    6·2 answers
  • Explain: The decode part of fetch decode execute cycle
    9·2 answers
  • Where do animators work?
    6·1 answer
  • Explain why microcomputers are installed with TCP/IP protocols?​
    15·1 answer
  • QUESTION 9 / 10
    13·1 answer
  • Identify the correct answer in each item. Write your answer on the blank provided before
    13·1 answer
  • What's the use of computer?Where are they used?​
    6·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!