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
lapo4ka [179]
4 years ago
8

Write a program that asks a user to roll a single die twice to get a sum value of 7. If the sum is 11, the user loses. If the su

m is neither 7 nor 11, the user neither wins nor loses, meaning that there is no decision. The computations have to be made inside a function named roll_die_twice. The input arguments are the numbers that show up in each die when it is rolled.

Computers and Technology
2 answers:
barxatty [35]4 years ago
6 0

Answer:

Check the explanation

Explanation:

#include <stdio.h>

int dice1;

int dice2;

int sum;

int roll_die_twice(int dice1,int dice2){

 

if(sum==7){

printf("winner");

 

}

else if (sum==11){

printf("looser");

}

else if (sum!=7 && sum!=11)

{

printf("nor winner or looser");

 

}

}

int main()

{

roll_die_twice(2,7);

return 0;

}

The code screenshot and code output can be seen in the attached image below.

Anestetic [448]4 years ago
6 0

Answer:

def roll_die_twice(num1, num2):

   if num1 + num2 == 7:

       print("You won")

   elif num1 + num2 == 11:

       print("You lost")

   elif (num1 + num2 != 7) or (num1 + num2 != 11):

       print("No winner or loser")

n1 = int(input("Roll the dice: "))

n2 = int(input("Roll the dice again: "))

roll_die_twice(n1, n2)

Explanation:

Create a function called roll_die_twice that takes two parameter, num1 and num2

Inside function, check the sum of the two numbers. If sum is equal to 7, print "You won". If sum is equal to 11, print "You lost". If sum is neither 7 nor 11, print "No winner or loser".

Get the numbers from the user

Call the function with given numbers

You might be interested in
The packet storm web site includes a large collection of packaged shellcode, including code that can:_____.
elena55 [62]

The packet storm web site includes a large collection of packaged shellcode, including code that can create a reverse shell that connects back to the hacker, flush firewall rules that currently block other attacks, and set up a listening service to launch a remote shell when connected to.

6 0
2 years ago
20. Which of the following describes an acceptable print resolution?
vodka [1.7K]
The correction is C.
One of the major factors that determine the quality of a printer is the resolution of that printer. The resolution is also called DPI [Dots Per Inch]. The DPI refers to amount of ink that an inkjet printer can place in a one inch line of a printed document. The higher the DPI of a printer, the higher the resolution.
6 0
3 years ago
Read 2 more answers
Why am I asked the 4th time to change my email &amp; password?????
dolphi86 [110]
Confirme your email.
3 0
3 years ago
Read 2 more answers
It is safe to interchange oxygen and fuel gas hoses. A. False B. True
Marat540 [252]
False.
If you were to interchange one another it would be VERY life threatening.
6 0
4 years ago
Read 2 more answers
How can artificial intelligence be used in learning science?
tiny-mole [99]

Artificial intelligence can be used to help science students research and verify their research. It is also a very interesting topic to study in general.

Hope that helped!!! k

5 0
4 years ago
Other questions:
  • Write the HTML to create a hyperlink to the named fragment designated by “top”.
    10·1 answer
  • How do you access the dark web? What are the negatives of doing this?
    14·1 answer
  • _____ is a computing model in which an organization outsources the equipment used to support its business operations, including
    15·1 answer
  • An it department submits a purchase order to buy a new computer from a vendor. Which hardware lifecycle does this scenario belon
    15·1 answer
  • Websites whose URL’s contain tildes (~) are usually published by the government. TRUE or FALSE.
    8·2 answers
  • Your computer has been showing signs of a malware infection, and today it started up in Safe Mode. Because your computer is not
    6·1 answer
  • Why is a partial mesh topology more common than a full mesh topology?
    5·2 answers
  • Write its features:features of computer ​
    15·1 answer
  • Please do in python.Given an array of integers, create a 2-dimensional array where the first element is a distinct value from th
    13·1 answer
  • A data analyst uses _____ to decide which data is relevant to their analysis and which data types and variables are appropriate
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!