JAVA
java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import java.util.Scanner;
public class Mul
{
public static void main(String[] args) {
int mul = 1;
Scanner input = new Scanner(System.in);
System .out.println ("Enter your initial number.");
int number = input.nextInt();
do{
mul *= number;
if(number<=0){
mul =0;
System .out.println (" Thank for using this program.");
}else{
//mul=1;
System .out.println ("What do you want to multiply by (0 to end)?");
number = input.nextInt();
}
}while(number>0 );
System .out .println ("The result is: "+ mul);
}
}
Enter to Rename, Shift+Enter to Preview
OUTPUT
Run