Q3) a) Write a function to simulate coin tossing, the function will use rand function that gives an output 0 or 1. Then function will return 0 as Head and return 1 as Tail. b) Write a complete program...


Q3)
a) Write a function to simulate coin tossing, the function will use rand function that
gives an output 0 or 1. Then function will return 0 as Head and return 1 as Tail.
b) Write a complete program in C to take a number (N) from the user and toss the coin
N times using the function defined in part a), and count the number of Heads and
number of Tails. Finally, print a histogram using ‘*’ for the number of Heads and
Tails. For example, if the number of Heads is 5 and number of Tails is 10, the

following histogram will be printed: (Hint: Use for loops for repetition and if/else
for selection of Head or Tail).


Q3)<br>a) Write a function to simulate coin tossing, the function will use rand function that<br>gives an output 0 or 1. Then function will return 0 as Head and return 1 as Tail.<br>b) Write a complete program in C to take a number (N) from the user and toss the coin<br>N times using the function defined in part a), and count the number of Heads and<br>number of Tails. Finally, print a histogram using *** for the number of Heads and<br>Tails. For example, if the number of Heads is 5 and number of Tails is 10, the<br>following histogram will be printed: (Hint: Use for loops for repetition and if/else<br>for selection of Head or Tail).<br>

Extracted text: Q3) a) Write a function to simulate coin tossing, the function will use rand function that gives an output 0 or 1. Then function will return 0 as Head and return 1 as Tail. b) Write a complete program in C to take a number (N) from the user and toss the coin N times using the function defined in part a), and count the number of Heads and number of Tails. Finally, print a histogram using *** for the number of Heads and Tails. For example, if the number of Heads is 5 and number of Tails is 10, the following histogram will be printed: (Hint: Use for loops for repetition and if/else for selection of Head or Tail).

Jun 06, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here