Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Let the user pick a number (say x) between 50 and 100. Now your program tosses a coin x times. In particular, your program can
Let the user pick a number (say x) between 50 and 100. Now your program tosses
a coin x times. In particular, your program can contain a loop and in each iteration it randomly makes a
choice: head (represented by 1) or tail (represented by 0), and stores the outcome (0 or 1) in an array. After
the iterations, traverse the array and count how many heads and tails were generated. Also, report the ratio
of number of heads and number of tails.
In Ruby language
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started