Computers and Technology

Write a program that lets a user enter N and that outputs N! (N factorial, meaning N*(N-1)*(N-2)*...*2*1). Hint: Initialize a variable total to N (where N is input), and use a loop variable i that counts from total-1 down to 1. Compare your output with some of these answers: 1:1, 2:2, 3:6, 4:24, 5:120, 8:40320.

Given sample code:
total = int(input()) # Read user-entered number
while i ? ??:#
Multiply total * (i-1)
# Decrement i

answer
Answers: 2

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 08:00, wgdelgado
What is the first step in creating a maintenance ?
Answers: 2
image
Computers and Technology, 24.06.2019 00:00, marika35
Visualizing a game of “tag” to remember the meaning of contagious
Answers: 3
image
Computers and Technology, 25.06.2019 01:30, marianaescamilla404
What was the advantage of using transistors instead of vacuum tubes in the second-generation computers? a. computers were drastically reduced in size. b. computers no longer produced errors. c. computers became affordable. d. computers could run on electricity.
Answers: 1
image
Computers and Technology, 25.06.2019 07:30, nellys2096
What does the hard disk drive do? it stores all of the information on a computer. it controls a computer’s operating system. it enables visual interaction with a computer. it contains all of a computer’s internal parts.
Answers: 1
Do you know the correct answer?
Write a program that lets a user enter N and that outputs N! (N factorial, meaning N*(N-1)*(N-2)*......

Questions in other subjects:

Konu
Mathematics, 05.03.2021 18:20
Konu
History, 05.03.2021 18:20