Answered step by step
Verified Expert Solution
Link Copied!

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

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

Step: 3

blur-text-image

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

What is loss of bone density and strength as ?

Answered: 1 week ago

Question

The paleolithic age human life, short write up ?

Answered: 1 week ago