Question: 7.5 Rewrite the factorial program of Figure 7.2 in Java so that the the initial value of n is read as input, and the final
7.5 Rewrite the factorial program of Figure 7.2 in Java so that the the initial value of n is read as input, and the final value of f is written to the screen. Now run the program for the values 2, 3, ... until the value off overflows the size of an int value. a. show your code b .What is the value of n for which this occurs? c. How is this error treated by Java? 7.6 For your C/C++ compiler, verify whether or not the cast of the integer 257 to a char results in an error. 7.7 For your Java compiler/interpreter, verify whether or not the cast of the integer 65537 to a char results in an error. 7.8 For both C and Java, write a program to compute 230 + 65534. Then convert this integer (or long int) to floating point by adding 1.0. Next convert the floating point number back to an integer and subtract 1. Do you get back the same integer you started with? Do not use double precision floating point. Show your code for both and discuss results
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
