u15
This commit is contained in:
parent
c7e805e9cb
commit
5dcfdc6f4f
Binary file not shown.
|
@ -0,0 +1,23 @@
|
|||
import java.util.Scanner;
|
||||
|
||||
/**
|
||||
* Klasse zum Ermitteln des Kumulativen Produkts beliebig vieler Zahlen
|
||||
*/
|
||||
public class KumulProd {
|
||||
public static void main(String[] args) {
|
||||
Scanner console = new Scanner(System.in);
|
||||
|
||||
System.out.print("Wieviele Zahlen? ");
|
||||
|
||||
int num = console.nextInt();
|
||||
|
||||
int prod = 1;
|
||||
|
||||
for (int i = 0; i < num; i++) {
|
||||
System.out.print((i + 1) + "-te Zahl: ");
|
||||
prod *= console.nextInt();
|
||||
}
|
||||
|
||||
System.out.println("Das kumulative Produkt ist: " + prod);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue