69.1k views
1 vote
develop a algorithm that will take in any number of pennies. After a number has been entered, it should calculate and display how many dollars are in the pennies. What is the input and output to this algorithm?

1 Answer

2 votes

Final answer:

The algorithm takes a number of pennies as input and calculates the number of dollars by dividing the pennies by 100. The input is an integer representing pennies, and the output is a decimal or integer representing dollars.

Step-by-step explanation:

The task is to develop an algorithm that takes an input of pennies and outputs the equivalent amount in dollars. Given that there are 100 pennies in a dollar, the algorithm should perform a simple division where the number of pennies entered is divided by 100 to find how many dollars those pennies make.

Algorithm Steps:

  1. Start the program.
  2. Input the total number of pennies.
  3. Divide the number of pennies by 100 to get the number of dollars.
  4. Display the number of dollars.
  5. End the program.

Input: The input to this algorithm is the total number of pennies (an integer).

Output: The output is the equivalent value in dollars (may be a decimal if the number of pennies is not a multiple of 100).

User Sayem
by
8.5k points

No related questions found