Mode:
Duration:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
public class FactorialProgram {
public Integer n = 5;
public Integer fact = 1;
public void calculate() {
for(Integer i = 1; i <= n; i++) {
fact *= i;
}
System.debug('Factorial: ' + fact);
}
}
FactorialProgram fp = new FactorialProgram();
fp.calculate();Coding works best on desktop or with an external keyboard.