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)<br>a)<br>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>C<br>C language<br>following histogram will be printed: (Hint: Use for loops for repetition and iflelse<br>for selection of Head or Tail).<br>Output:<br>Head: 10 * *********<br>Tail: 5 *****<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 C C language following histogram will be printed: (Hint: Use for loops for repetition and iflelse for selection of Head or Tail). Output: Head: 10 * ********* Tail: 5 *****

Jun 06, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here