Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write the following in C program: 1. There's a birthday in our class today! Or will there be two? How likely it is that two

Write the following in C program:

image text in transcribed

image text in transcribed

1. There's a birthday in our class today! Or will there be two? How likely it is that two people in one section of our class (40 students have the same birthday? Suggested Approach 1. Prepare an integer array, a 40, to hold birthdays for 40 students. 2. Generate a random number between 1 and 365 and assign the number to each element of all. Use the operator (Example: 300%7 returns the remainder of 300 divided by 7). 3. Compare al0] with the rest of the students' birthdays (i.e. a[1], a[2], a122]) and if there is a match, get out of the loop increment the counter by 1 and go to #2 (the next round of simulation). 4. Compare alij with the rest of the students' birthdays (i.e. a[2], a[3], a122]) and if there is a match, get out of the loop increment the counter by 1 and go to #2 (the next round of simulation). 5. Compare a12] with the rest of the students' birthdays (i.e. a a 4], a122]) and if there is a match, get out of the loop increment the counter by 1 and go to #2 (the next round of simulation). 6. Compare a13] with the rest of the students' birthdays (i.e. a[4], a 5, a1221) and if there is a match, get out of the loop increment the counter by 1 and go to #2 (the next round of simulation). 8. After n simulations, compute the value of counter

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

Database Reliability Engineering Designing And Operating Resilient Database Systems

Authors: Laine Campbell, Charity Majors

1st Edition

978-1491925942

More Books

Students also viewed these Databases questions

Question

Assignment 2 Question 4 of 10

Answered: 1 week ago

Question

What is the basis for Security Concerns in Cloud Computing?

Answered: 1 week ago

Question

Describe the three main Cloud Computing Environments.

Answered: 1 week ago