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
A rookie programmer has just typed over 1000 lines code into the command line interpreter for a project that is due the next day
Kipish [7]

Answer:

I believe the answer is ''You have to remove all code from the interpreter before closing it'.

Explanation:

3 0
3 years ago
Where do you find the Merge Style dialog box to merge styles from one workbook to another? in the Home tab, then Styles group in
DiKsa [7]

Answer:A in the home tab then styles group

Explanation:

3 0
3 years ago
Read 2 more answers
Machine language—0s and 1s—would be very difficult for a programmer to write in; thus a low-level (second-generation) language,
adelina 88 [10]

Answer:

Assembly Language.

Explanation:

Machine Language:- It is the lowest level programming language.It represent that the data in the form of 1's and 0's it is like this because the machines understand only binary or 1's and 0's.

Assembly Language:-It is the second generation of programming language.It can be used by a programmers to write program using abbreviations and basic words instead of binary numbers.

5 0
4 years ago
Name the wireless technology that may work with one device and not with another.
horsena [70]

Answer: Im guessing b

Explanation:

bc the other ones work devices.

7 0
3 years ago
Oof x oof = ? idk what that is
saveliy_v [14]

Answer:

= 1 off!

Explanation:

1x1

4 0
3 years ago
Read 2 more answers
Other questions:
  • Which career professional and creates large data base and makes the data base with other systems
    13·1 answer
  • Which command compiles the java source code file welcome.java?
    9·1 answer
  • How do you know if the website is secure if you make a purchase
    13·2 answers
  • How do we call a very small video,that is repeating unlimitedely
    10·2 answers
  • A ________ determines what cpus a system can use, what integrated ports the system can provide without use of third-party produc
    5·1 answer
  • Match the items with their respective descriptions.
    6·2 answers
  • Write a recursive function that calculates the sum 11 22 33 ... nn, given an integer value of nin between 1 and 9. You can write
    10·1 answer
  • What precautions should be taken to make a computer more secure ​
    8·1 answer
  • One advantage of a PAN​
    10·2 answers
  • What number is represented as a binary code of 101110
    5·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!