Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

5) a) Using a byte variable, what is the largest factorial that can be calculate

ID: 3603249 • Letter: 5

Question

5) a) Using a byte variable, what is the largest factorial that can

be calculated. A factorial is simply

n! = 1 * 2 * 3 * 4 ... * (n-2) * (n-1) * n

For instance, 1! = 1, 2! = 2, 3! = 6, 4! = 24, 5! = 120 etc....

b) What would be the largest factorial using short, int, long, float,

double, etc... Use all the primitive data types that you are familiar

with signed as well as unsigned.

Note: I want you to investigate this and the program you

turn in should just print "cout" the final results. You don't know

how to capture errors yet so run each till it overflows then back off by 1.

Don't need the program that tests for this.

Explanation / Answer

The factorial of a number is defined is the product of natural numbers from one to that particular number. Mathematically,

n! = 1 * 2 * 3 * .... * (n-1) * n

For example, the factorial of 4 is

4! = 1 * 2 * 3 * 4 = 24

This article will explain you how to find the factorial of a number through iteration as well as recursion.

2.

Category Types Size (bits) Minimum Value Maximum Value Precision Example Integer byte 8 -128 127 From +127 to -128 byte b = 65; char 16 0 216-1 All Unicode characters char c = 'A';
char c = 65; short 16 -215 215-1 From +32,767 to -32,768 short s = 65; int 32 -231 231-1 From +2,147,483,647 to -2,147,483,648 int i = 65; long 64 -263 263-1 From +9,223,372,036,854,775,807 to -9,223,372,036,854,775,808 long l = 65L; Floating-point float 32 2-149 (2-2-23)·2127 From 3.402,823,5 E+38 to 1.4 E-45 float f = 65f; double 64 2-1074 (2-2-52)·21023 From 1.797,693,134,862,315,7 E+308 to 4.9 E-324 double d = 65.55; Other boolean 1 -- -- false, true boolean b = true; void -- -- -- -- --
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote