Question: Java Program Write a program which asks calculates the factorial of a number n. The number n must be taken from the user. The

 

Java Program Write a program which asks calculates the factorial of a

Java Program Write a program which asks calculates the factorial of a number n. The number n must be taken from the user. The program should calculate the factorial and should ask user that does he/she wants to calculate factorial of another number. If the user enters 'y' or 'Y' then the program must ask for another number for which factorial needs to be calculated. A sample output is shown on next page. (Hint: Factorial of any integer is multiplication of that integer with all other integers less than that integer till integer 1. For example factorial of 4 is 4*3*2*1 and factorial of 7 is 7*6*5*4*3*2*1. Specifications . . Ask the user to enter a number and then calculate factorial of that number (Hint: use loop to calculate factorial). (Marks 5) Ask user do you want calculate factorial of another number. If the user types 'y or 'Y' ask the user to enter another number. The process should continue until the user keeps on entering 'y or 'Y. Use a loop for asking user to enter number again. (Marks 2) Please enter the number for which you want to calculate the factorial: 4 24 Do you want to calculate factorial of another number? Y Please enter the number for which you want to calculate the factorial: 5 120 Do you want to calculate factorial of another number? Y Please enter the number for which you want to calculate the factorial: 6 720 Do you wady to calculate factorial of another number? n Bye! Your answer

Step by Step Solution

3.39 Rating (149 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Code import javautilScanner public class FactorialCalculator p... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!