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
artcher [175]
3 years ago
9

A car holds 16 gallons of gasoline and can travel 312 miles before refueling. Write aC++ program that calculates the number of m

iles per gallon the car gets. Display the result on the screen.
Computers and Technology
1 answer:
IgorC [24]3 years ago
6 0

Answer:

// here is code in C++.

#include <bits/stdc++.h>

using namespace std;

// main function

int main()

{

   // variables Declaration and initialization

   int no_gallon=16;

   int dis=312;

   // find the miles per gallon

   double mile_gallon=dis/double(no_gallon);

   // print the results

   cout<<"number of gallons: "<<no_gallon<<endl;

   cout<<"distance travel before refueling: "<<dis<<endl;

   cout<<"miles per gallon is: "<<mile_gallon<<endl;

return 0;

}

Explanation:

Declare and initialize the number of gallon and distance travel without refueling. Calculate the miles per gallon by dividing distance with number of gallons.Then print the results.

Output:

number of gallons: 16

distance travel before refueling: 312

miles per gallon is: 19.5

You might be interested in
Crop marks are used on an illustration to indicate to the printer the
Advocard [28]
Crop marks are used on an illustration to indicate to the printer the A. center point of the illustration. Hope this helped!.
5 0
3 years ago
Who are the best candidates for members of skills USA?
Kryger [21]

Answer:

Is there more to the question? But I have had this question already and the answer is B)

7 0
3 years ago
4.5 code practice edhesive
Bezzdna [24]

Answer:

n= input("Please enter the next word: ")

x=1

while(n != "STOP"):

 print("#" + str(x) + ": You entered " + n)

  x=x+1

  n= input("Please enter the next word: ")

print("All done. " + str(x-1) + " words entered.")

Explanation:

8 0
3 years ago
g write a recursive function that prints out all the even numbers between x and y inclusive if x is odd then the print out will
Reil [10]

Answer:

The function written in python is as follows:

def EvenNumbers(x, y):

    if (y < x):

         return

    if (y % 2 == 0):

         EvenNumbers(x, y - 2)

    else:

         EvenNumbers(x, y - 1)

    if (y % 2 == 0):

         print(y)

Explanation:

x represents the lower limit while y represents the upper limit.

So, the recursion will be repeated as long as x <= y

This defines the function

def EvenNumbers(x, y):

This checks if y < x. If yes, the recursion stops execution and return to the main

<em>     if (y < x): </em>

<em>          return </em>

The following if and else condition checks determines the appropriate range of the recursion.

<em>     if (y % 2 == 0): </em>

<em>          EvenNumbers(x, y - 2) </em>

<em>     else: </em>

<em>          EvenNumbers(x, y - 1) </em>

The above takes care of printing starting at x + 1 if x is odd

This checks and prints the even numbers in the range

<em>     if (y % 2 == 0): </em>

<em>          print(y)</em>

<em />

To call the function from main, make use of

EvenNumbers(x, y)

Where x and y are integers

e.g EvenNumbers(2,10), EvenNumbers(1,17), EvenNumbers(3,21)

<em>See attachment</em>

3 0
3 years ago
Can anyone give me Nitro type gold please? My NT account is trapkaybee061307
Rasek [7]

Answer:

no

Explanation:

3 0
3 years ago
Read 2 more answers
Other questions:
  • A folder window shows you he contents of the folder
    8·1 answer
  • Which dialog box opens after selecting a cell in the list of prepared data, clicking the insert tab on ribbon and the clicking t
    6·1 answer
  • Which of the following experiences is considered a simulation?
    12·1 answer
  • In what order does the air flow in a canister vacuum cleaner pass through the following components?
    11·1 answer
  • Which are emotional effects of anxiety? Check all that apply.
    10·2 answers
  • Denise is using Outlook 2016 in a business environment. Her company operates a Microsoft Exchange email server.
    6·2 answers
  • Cryptocurrencies are digital tokens that are created independently of government money, and can act as a medium of exchange and
    15·1 answer
  • Monster Collector
    7·1 answer
  • Here you guys go im back didnt die or any thing gg for who ever gets this
    11·2 answers
  • 8.10.8 guess the passcode codehs
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!