Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

 

image

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

Step: 1

Code import javautilScanner public class FactorialCalculator p... 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

Step: 3

blur-text-image

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

Elements Of Chemical Reaction Engineering

Authors: H. Fogler

6th Edition

013548622X, 978-0135486221

More Books

Students also viewed these Programming questions

Question

1. How does the idea of allostasis differ from homeostasis?

Answered: 1 week ago