33.2k views
3 votes
Write a program that accepts a whole number as input, multiplies that number by 21, and then outputs the product.

Hint: Remember to think about the data type that the user will input. How can you make sure that their input is entered as a number?

1 Answer

2 votes

Final answer:

To write this program, use Python to accept a whole number, multiply it by 21, and output the product.


Step-by-step explanation:

To write a program that accepts a whole number as input, multiplies it by 21, and then outputs the product, you can use a programming language like Python. Firstly, you need to take user input as a string and convert it to an integer to ensure it is a number. Then, you can multiply the input by 21 and display the result. Here's an example:

number = int(input('Enter a whole number: ')) product = number * 21 print('The product is:', product)

Learn more about Writing a program to accept a whole number, multiply it by 21, and output the product

User Smyrnian
by
7.7k points