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, 21.06.2019 22:00
Problems: 1. using textbooks, reference books, and internet as your source of research, draw the following microprocessor microarchitectures i. intel 8086 ii. motorola 68000 i atmel atmega32 iv. mips single cycle v. arm cortex-m3 write an hdl module for a hexadecimal seven-segment display decoder. the input is 4-bit binary representing a hex number (0-f), and the output is 8-bit seven segment display bits (a-h). thus, the decoder must handle the digits 10 - 15 to display a-f respectively, in addition to 0-9 numbers. 2. design a 4-bit left and right rotator (both outputs). first sketch schematic diagrams of your design. then implement your design using hdl coding. 3. 4. design a modified priority encoder that receives an 8-bit input, a7: 0 and produces a 3-bit output, y2o. y indicates the most significant bit of the input that is true. y should be 0 if none of the inputs are true. give a simplified boolean equation, sketch a schematic, and write an hdl code. 5.write an 8: 1 multiplexer module called mux8 with selection inputs s, data input d, and data output y. data input (d) and data output (v) are 32-bit wide
Answers: 3
question
Computers and Technology, 21.06.2019 22:30
Aprovides legal protection for something an individual has created
Answers: 1
question
Computers and Technology, 22.06.2019 11:00
The great length of north america causes the climate to be varied. true false
Answers: 2
question
Computers and Technology, 22.06.2019 14:00
Which database model is best used for data warehouse and data mining
Answers: 3
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, 15.07.2020 01:01
question
Mathematics, 15.07.2020 01:01
question
Mathematics, 15.07.2020 01:01
Questions on the website: 13722360