Lab4
import java.io.*;
public class work {
public static void main(String[] args) throws IOException
{
BufferedReader keyboard= new BufferedReader(new InputStreamReader(System.in));
System.out.println("Enter the number1:");
String number1 = keyboard.readLine();
int x = Integer.parseInt(number1);
System.out.println("Enter the number2:");
String number2 = keyboard.readLine();
int y = Integer.parseInt(number2);
int z = x*y;
System.out.println("number1 is " +x);
System.out.println("number2 is "+ y);
System.out.println("The total number of number1*number2 = " + z);
}
}
結果:
Enter the number1:
999
Enter the number2:
888
number1 is 999
number2 is 888
The total number of number1*number2 = 887112
0 Comments:
張貼留言
<< Home