(3.)Schreiben Sie eine Anwendung, welche die Fakultät von 1…5 berechnet und in einer Tabelle ausgibt!:
1! =1 =1
2! =1*2 =2
3! =1*2*3 =6
4! =1*2*3*4 =24
5! =1*2*3*4*5 =120
Verallgemeinern Sie wiederum für beliebige n!
das ist meine aufgabe, ich bekomm sie nicht hin
das habe ich bis jetzt:
public class MyClass {
public static void main(String args[]) {
Integer n = 5;
Integer x= 1;
Integer i= 1;
Integer s= 1;
String o= "*";
System.out.println(i+"!"+" ="+x+" ="+i );
while( x<n){
x=x+1;
i= i*x;
System.out.println(x+"!"+" ="+s+"*"+n+" ="+i );
s=s+1;
}
}
}
kann mir jemand helfen
1! =1 =1
2! =1*2 =2
3! =1*2*3 =6
4! =1*2*3*4 =24
5! =1*2*3*4*5 =120
Verallgemeinern Sie wiederum für beliebige n!
das ist meine aufgabe, ich bekomm sie nicht hin
das habe ich bis jetzt:
public class MyClass {
public static void main(String args[]) {
Integer n = 5;
Integer x= 1;
Integer i= 1;
Integer s= 1;
String o= "*";
System.out.println(i+"!"+" ="+x+" ="+i );
while( x<n){
x=x+1;
i= i*x;
System.out.println(x+"!"+" ="+s+"*"+n+" ="+i );
s=s+1;
}
}
}
kann mir jemand helfen