Ask Question
4 May, 13:10

Write a program that prompts the user to input the number of quarters, dimes, and nickels. The program then outputs the total value of the coins in pennies.

+4
Answers (1)
  1. 4 May, 14:03
    0
    The program to this question can be given as follows:

    Program:

    #defining variable quarters, dimes, and nickels.

    quarters=int (input ("Enter value of quarters: ")) #input value by user dimes=int (input ("Enter value of dimes: ")) #input value by user nickels=int (input ("Enter value of nickels: ")) #input value by user

    #defining variable pennies

    pennies = ((25*quarters) + (10*dimes) + (5*nickels)) #calculate value in pennies variable

    print ('Total number of coins in pennies is: ', pennies) #print value

    Output:

    Enter value of quarters: 3

    Enter value of dimes: 2

    Enter value of nickels: 1

    Total number of coins in pennies is: 100

    Explanation:

    In the above python program code, firstly three variable "quarters, dimes, and nickels", all of these variable uses input function, that is used to take input value from the user side, in these variable, an int is used that defined, that user input only integer value.

    After taking input from the user a new variable "pennies" is defined, which is uses the user input values and calculates its addition. In the next line, print function is used, which uses variable "pennies" to print its calculated value.
Know the Answer?
Not Sure About the Answer?
Find an answer to your question ✅ “Write a program that prompts the user to input the number of quarters, dimes, and nickels. The program then outputs the total value of the ...” in 📘 Computers and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers