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]
3 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]3 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]3 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
How will advertising and communications change as technology improves?????? HELP PLEASE :0 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
drek231 [11]

Technology changes advertising and communications by increasing the outreach of people that will get the message, and increasing the speed at which they get the message. Which in turn makes the advertising more relevent because they can release more product to a wider audience during a specific time period.


6 0
3 years ago
How much time does a gold chest take to open
MaRussiya [10]

Gold chest takes 8 hours to open or unlock.

<u>Explanation:</u>

Clash royale is a game which has been developed and published with the help of a super cell. It is a video game. Many players can play this game at the same time. In the sense, clash royale is a multi player game.

In this game, the players who are playing the game are awarded with the gold chest. They are also awarded with the gems. In order to unlock or open a gold chest eight hours are needed. Apart from this there is an other way also with which the gold chest can be unlocked. It can be unlocked with the help of forty eight gems.

7 0
3 years ago
Write a program using Python that prompts for an integer and prints the integer, but if something other than an integer is input
Tcecarenko [31]

Answer:

#program in Python

#read until user Enter an integer

while True:

   #try block to check integer

   try:

       #read input from user

       inp = int(input("Enter an integer: "))

       #print input

       print("The integer is: ",inp)

       break

   #if input is not integer

   except ValueError:

       #print message

       print("Wrong: try again.")

Explanation:

In try block, read input from user.If the input is not integer the print a message  in except block.Read the input until user enter an integer. When user enter an  integer then print the integer and break the loop.

Output:

Enter an integer: acs                                                                                                      

Wrong: try again.                                                                                                          

Enter an integer: 4a                                                                                                      

Wrong: try again.                                                                                                          

Enter an integer: 2.2                                                                                                      

Wrong: try again.                                                                                                          

Enter an integer: 12                                                                                                      

The integer is:  12  

7 0
3 years ago
Read 2 more answers
Write the function "zipper". the function will take two array/list/table parameters and return a new array/list/table which will
MakcuM [25]
What is the problem what am I supposed to do?
4 0
4 years ago
Why was Windows 1.0 considered an operating environment rather than an operating system?
wolverine [178]

Windows 1.0 was only a shell program

The operating system for Windows 1.0 was MS-DOS

4 0
4 years ago
Read 2 more answers
Other questions:
  • Match the job skills with the correct job role.
    12·1 answer
  • Generate the requested sets using only set builder notation and the provided sets. Some problems may require you to build one or
    15·1 answer
  • 1.Customer service is assistance provided by a company to the people who buy or use its products or services.
    13·2 answers
  • If a tv was showing a flat black or blue screen or had "snow", what steps would you take to fix it? Give an example of the direc
    11·1 answer
  • Convert 15 from decimal to binary. Show your work.
    14·1 answer
  • 1. in terms of technology, we often said to be living in the _____ age.???
    15·2 answers
  • Design the logic for a program that allows a user to enter 20 numbers, then displays each number and its difference from the num
    13·1 answer
  • When using the Common Internet File System (CIFS), which security model does not require a password to be set for the file share
    7·1 answer
  • How do I type the integral symbol?
    6·1 answer
  • What is a mod in programming?<br><br> Give more Java questions
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!