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
otez555 [7]
3 years ago
8

C# The video game machine at your local arcade output coupons according to how well you play the game. You can redeem 10 coupons

for a candy bar or 3 coupons for a gumball. You prefer candy bars to gumballs. Write a program that defines a variable initially assigned to the number of coupons you win. Next, the program should output how many candy bars and gumballs you can get if you spend all of your coupons on candy bars first, and any remaining coupons on gumballs.
Computers and Technology
1 answer:
slamgirl [31]3 years ago
5 0

Answer:

#include<iostream>

using namespace std;

/* main is a function without a parameters which returns an int value*/

int main( )

{

/* declare int data type for numeric values initialize candyBar and gumBall */

int coupons, cabdyBr=10,gumall=3;

int candyBarAmount,gumBallAmount,remainder;

/* cout is used to show the message to user cin to read user input from keyboard and sets the value to coupon */

cout<<"Enter the number of coupons"\t";

cin>>coupons;

/* First check coupons with cabdyBar */

if (coupons >= candyBar)

{

candyBarAmount=coupons/candyBar;

remainder=coupons-(candyBarAmount*10);

}

else

{

candyBarAmount=0;

}

/* check remaining value with gumBall */

if (remainder<<candyBar && remainder>=gumBall)

{

gumBallAmount=remainder/gumball;

}

else

{

gumBallAmount=0;

}

/* show thw required output to the user */

cout<<"The number of Candy bars is "<< candyBarAmount <<endl;

cout<<"The number of gumballs is "<<gumballAmount <<endl;

/* The program ends and return 0 as the functions value */

return 0;

}

<u>OUTPUT</u>

Enter the number of coupons: 23

The number of candy bars = 2

The number of gumballs = 1

You might be interested in
Does anyone know the answer to 2 and 3
docker41 [41]
No because u ain’t put the question up here for someone to answer
6 0
3 years ago
Write a class of complex numbers consisting of:
Gnom [1K]

Answer:

hi sorry for not knowing the answer

but please follow have a great day,night, or afternoon

3 0
3 years ago
Within a single program, __________________ allows multiple parts, or threads, to run simultaneously.
jekas [21]
<span>It should be single-user/multitasking os.</span>
4 0
4 years ago
One way to describe the note-taking tool eNotes is to call it an<br> Someone help ._.
vagabundo [1.1K]

Answer:

Electronic notebook

5 0
4 years ago
Read 2 more answers
A man travel 200m towards east&lt;br /&gt;from his house then takes left&lt;br /&gt;to turn and moves 200 m north&lt;br /&gt;fin
11Alexandr11 [23.1K]
Using the Pythagorean theorem:

200^2 + 200^2 = x^2

x = 282.842712... from the original distance
4 0
4 years ago
Other questions:
  • Which version represents the video project after the assembly cut has been completed, transitions and special effects have been
    9·1 answer
  • Which best describes what Pavel should do differently for the kids book?
    13·2 answers
  • Change the shape fill color to Dark Red. It is the first option in the Standard Colors section of the color palette.
    13·1 answer
  • All systems have ___________.
    9·2 answers
  • A key requirement for the process of testing hypotheses in the scientific method is Group of answer choices experimenter bias. c
    9·1 answer
  • 14. Which of the following statements is true? A. The most secure email message authenticity and confidentiality isprovided by s
    11·1 answer
  • Explain working principle of computer.​
    5·2 answers
  • Why accessing information over the internet is so convenient.​
    11·1 answer
  • What underlying concept is edge computing based on?
    13·2 answers
  • Chantal has configured the network at her company's new headquarters with a number of VLANs. All devices joined to the individua
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!