What is the output, if n is 3?
for (int i = 1; i <= n; ++i) {
int factorial = 1;
factorial = factorial * i;
system.out.print(factorial + " ");
}
1 1 1
1 2 3
1 2 6
Error: Cannot use the loop variable i inside the
for loop.
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
What is the output if n is 3 for int i 1 i lt n ++.pdf
1. What is the output, if n is 3?
for (int i = 1; i <= n; ++i) {
int factorial = 1;
factorial = factorial * i;
system.out.print(factorial + " ");
}
1 1 1
1 2 3
1 2 6
Error: Cannot use the loop variable i inside the
for loop