subject

Write a program that reads in an integer greater than 1 in from the user. the program then computes and print out the factorial of the number read in. the factorial of a number is the product of all the natural numbers less than or equal to the number itself. that is the factorial of n is 1*2*3* (n-2)*(n1)*n. your program should stop if the user enters a negative number. design you will probably want to make a class called integer which has a single instance variable of class int. this class would also have an accessor method for the value and a method factorial, which will compute the factorial. this separates the input and output from the computation. sample output enter a number: 5 the factorial of 5 is 120. enter a number: 8 the factorial of 8 is 40320. enter a number: 12 the factorial of 12 is 479001600. enter a number: -1 you and bye.

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 17:00
Which of the following is not contained on the slide show toolbar? a. next button b. slide button c. close button d. pen too
Answers: 2
question
Computers and Technology, 22.06.2019 17:00
Which of the following is not contained on the slide show toolbar? a. next button b. slide button c. close button d. pen tool
Answers: 1
question
Computers and Technology, 23.06.2019 16:30
What is one reason why indoor air pollution has become an increasing problem.
Answers: 1
question
Computers and Technology, 23.06.2019 17:00
What are the 12 colors of the spectrum called?
Answers: 1
You know the right answer?
Write a program that reads in an integer greater than 1 in from the user. the program then computes...
Questions
question
Mathematics, 29.10.2020 18:40
question
Mathematics, 29.10.2020 18:40