Factorials by CodeChum Admin For those of you who may not now, a factorial is a product of multiplying from 1 until the number. Now, you must make a program that will accept an integer and then print out its factorial using loops.   Are you up for this task?   Instructions: Input a positive integer. Using a for() loop, generate the factorial value of the integer and print out the result. Tip #1: Factorials work like this: Factorial of 5 = 1 * 2 * 3 * 4 * 5 Tip #2: There's a special case in factorials. The factorial of 0 is 1. Input A line containing an integer. 5 Output A line containing an integer. 120   Test Cases Input 5 Your Output Factorial of 5 is: 120 Expected Output 120 cancel Test Case 2 expand_less Input 7 Your Output Factorial of 5 is: 120 Expected Output 5040 Test Case 3 hidden Test Case 4 hidden Test Case 5 hidden Test Case 6 hidden

Programming with Microsoft Visual Basic 2017
8th Edition
ISBN:9781337102124
Author:Diane Zak
Publisher:Diane Zak
Chapter5: The Repetition Structure
Section: Chapter Questions
Problem 3RQ
icon
Related questions
Question

. Factorials

by CodeChum Admin

For those of you who may not now, a factorial is a product of multiplying from 1 until the number. Now, you must make a program that will accept an integer and then print out its factorial using loops.

 

Are you up for this task?

 

Instructions:

  1. Input a positive integer.
  2. Using a for() loop, generate the factorial value of the integer and print out the result.
  3. Tip #1: Factorials work like this: Factorial of 5 = 1 * 2 * 3 * 4 * 5
  4. Tip #2: There's a special case in factorials. The factorial of 0 is 1.

Input

A line containing an integer.

5

Output

A line containing an integer.

120
 
Test Cases

Input

5

Your Output

Factorial of 5 is: 120

Expected Output

120
cancel
Test Case 2
expand_less

Input

7

Your Output

Factorial of 5 is: 120

Expected Output

5040

Test Case 3
hidden
Test Case 4
hidden
Test Case 5
hidden
Test Case 6

hidden

Expert Solution
steps

Step by step

Solved in 4 steps with 3 images

Blurred answer
Knowledge Booster
Computational Systems
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Programming with Microsoft Visual Basic 2017
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:
9781337102124
Author:
Diane Zak
Publisher:
Cengage Learning