im trying to implement a way to calculate facultys with for loops for a university project. I wrote a for loop that increases in steps of two, while another for loop calculates each faculty for the first for loop.
Can anybody point out where i made a mistake?
package Cosinus;
public class MainCos {
public static void main(String[] args) {
int fact=1;
for(int number = 0; number <= 10; number += 2) {
for(int i=1;i<=number;i++){
fact=fact*i;
}
System.out.println("The Faculty of " + number + " is: " + fact);
}
}
}