Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Hopefully a third time will be the charm.. two prior times the output has NOT worked for EXACTLY what the question is asking for... In

Hopefully a third time will be the charm.. two prior times the output has NOT worked for EXACTLY what the question is asking for...

In mathematics, the notation n! represents the factorial of the nonnegative integer n. The factorial of n is the product of all the non-negative integers from 1 to n. For example: 7! = 1 2 3 4 5 6 7 = 5,040 and 4! = 1 2 3 4 = 24 Write a program that lets the user enter a nonnegative integer then uses a loop to calculate and display the factorial of that number. Your output should be formatted like the following: Enter a non-negative integer: 10 The factorial of 10 is: 10! = 1 2 3 4 5 6 7 8 9 10 = 3,628,800 Another example: Enter a non-negative integer: 5 The factorial of 5 is: 5! = 1 2 3 4 5 = 120 Hint: This isnt as easy as it looks. You will need to concatenate a string inside of your loop and have conditional decisions to build the 1 2 3 output (every loop does one thing except for the last). Note that this does not use a lowercase X but the multiplication symbol which is: \u02df just like we did with the degree symbol in Chapter 2 *** last person who answered this did not put the output with the comma.. i do not know how to do that and there was nowhere to put a comment so i am reposting*** also if this can be answered using "print" instead of display that will help . If anyone can help me understand how to print the 1x2x3x4x5x etc based on the number the user enters thats where im stuck

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

SQL Database Programming

Authors: Chris Fehily

1st Edition

1937842312, 978-1937842314

More Books

Students also viewed these Databases questions