practice1
import java.io.*;
public class practice1
{
public static void main(String[] args)throws IOException
{
BufferedReader keyin= new BufferedReader(new InputStreamReader(System.in));
System.out.println("Please enter some numbers ");
String numberString=keyin.readLine();
int number = Integer.parseInt(numberString.trim());
int answer=1;
while(number > 0)
{
answer=answer*number;
numberString = keyin.readLine();
number = Integer.parseInt(numberString.trim());
}
System.out.println("sum is "+answer);
}
}
0 Comments:
張貼留言
<< Home