Objectives: In program C. NOT C++ or python • How to use the random number generation. • How to call function and return data to the main function. • How to print in a tabular form. Write a program that simulate coin tossing. • For each toss of the coin the program should either prints Heads or Tails. • Let the program toss the coin 100 times, and count the number of times each side of the coin appears. • The program should call a separate function called “flip”, that takes no argument and returns 0 for tails and 1 for heads using random generator. • The program should print the result received either “Heads”, or “Tails”. • The print should be in tabular form 10 in a row on one line after another, see figure below. -The result should be completely random. In other words, the number of heads and tails should be different each time you run the program
Objectives: In program C. NOT C++ or python • How to use the random number generation. • How to call function and return data to the main function. • How to print in a tabular form. Write a program that simulate coin tossing. • For each toss of the coin the program should either prints Heads or Tails. • Let the program toss the coin 100 times, and count the number of times each side of the coin appears. • The program should call a separate function called “flip”, that takes no argument and returns 0 for tails and 1 for heads using random generator. • The program should print the result received either “Heads”, or “Tails”. • The print should be in tabular form 10 in a row on one line after another, see figure below. -The result should be completely random. In other words, the number of heads and tails should be different each time you run the program
Step by step
Solved in 2 steps with 2 images