A factorial of a number is the product of all positive integers less than or equal to that number.
For example, the factorial of 5 is: 5 × 4 × 3 × 2 × 1 = 120.
In Java, this can be achieved using a for loop, where we multiply the number iteratively.
Below is the Java program to compute the factorial of 5:
This program initializes a variable factorial to 1 and multiplies it by each number from 1 to 5 using a for loop.
Finally, the result is printed on the screen.
If vector \( \mathbf{a} = 3 \hat{i} + 2 \hat{j} - \hat{k} \) \text{ and } \( \mathbf{b} = \hat{i} - \hat{j} + \hat{k} \), then which of the following is correct?