1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
lesantik [10]
4 years ago
13

In C language

Computers and Technology
1 answer:
devlian [24]4 years ago
8 0

Answer:

The program in C is as follows:

#include <stdio.h>

#include <stdlib.h>

#include <time.h>

int main(){

   int dice [1000];

   int count [6]={0};

   srand(time(0));

   for (int i = 0; i < 1000; i++) {

       dice[i] = (rand() %(6)) + 1;

       count[dice[i]-1]++;

   }

   for (int i = 0; i < 6; i++) {

       printf("%d %s %d %s",(i+1)," occurs ",count[i]," times");

       printf("\n");

   }

   return 0;

}

Explanation:

This declares an array that hold each outcome

   int dice [1000];

This declares an array that holds the count of each outcome

   int count [6]={0};

This lets the program generate different random numbers

   srand(time(0));

This loop is repeated 1000 times

   for (int i = 0; i < 1000; i++) {

This generates an outcome between 1 and 6 (inclusive)

       dice[i] = (rand() %(6)) + 1;

This counts the occurrence of each outcome

       count[dice[i]-1]++;    }

The following prints the occurrence of each outcome

   for (int i = 0; i < 6; i++) {

       printf("%d %s %d %s",(i+1)," occurs ",count[i]," times");

       printf("\n");    }

You might be interested in
What kind of document serves as a legally binding contract or part of a contract that defines, in plain language and in measurab
s344n2d4d5 [400]

Answer:

C. memorandum of understanding

Explanation:

A memorandum of understanding is a type of agreement between two or more parties. It expresses a convergence of will between the parties, indicating an intended common line of action.

5 0
4 years ago
This week you will learn about basic code structure. The term structure, as it relates to programming, refers to the decisions y
GenaCL600 [577]
Instead of having to write multiple pieces of code for different outcomes, you can use an elseif statement and make your code easier to read and easier to understand.
8 0
4 years ago
Your boss has asked you to create a customized letterhead for the business, "Boyne Mountain Ski Shop". Explain how to create the
lakkis [162]

Creating a letter head is very simple. However, you need to do some planning. You are required to pick a size and shape accordingly. I would prefer a landscape oriented rectangle. Select a theme appropriate and consistent with the traits of you company. Personalize with a simple and sleek image that can be printed easily if necessary. Select a font that is bold enough, readable, and eye catching. You can include items like a slogan, a name, phone numbers, address, email address, a link to you web address and the established dates.

5 0
3 years ago
Here is something cool
makkiz [27]
Cool beans s s s s s s s s
4 0
3 years ago
Read 2 more answers
Convert (520)10 into base 16​
kakasveta [241]
The base-10 value of 52010 is equal to base-16 value of 20816.
3 0
3 years ago
Read 2 more answers
Other questions:
  • Which company provides the Loki Wi-Fi mapping service?
    10·1 answer
  • Can someone help me out with this one? I'm not sure why my code is not working
    11·1 answer
  • Sensitive security information can be shared with whom
    13·2 answers
  • Differences between Quality of Services and a Service of Quality approach
    9·1 answer
  • A user calls to report that she is experiencing intermittent problems while accessing the wireless network form her laptop compu
    9·1 answer
  • I want to discard my old computer and want to securely erase the data from my hard drive what is the process called.
    14·2 answers
  • As a digital investigator for your local sheriff’s department, you have been asked to go with a detective to a local school that
    13·1 answer
  • Convert ⅖ pie radian to degree​
    15·1 answer
  • How can you continue learning about computer science and improve your coding abilities?
    5·1 answer
  • The Zoom feature allows you to either increase or decrease the size of your document on the screen,
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!