2009年3月9日 星期一

Lab Keyboard input

enter


------------------------------------------------<程式碼開始>--------------------------------------


import java.awt.*;
import java.applet.*;
import javax.swing.*;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
public class S952621502 extends JApplet {
public static void main( String[] args ) throws IOException
{
System.out.println("Enter two number to add");
BufferedReader keyboard= new BufferedReader(new InputStreamReader(System.in));
String n1 = keyboard.readLine();
String n2 = keyboard.readLine();
int N1 = Integer.parseInt(n1);
int N2 = Integer.parseInt(n2);
int N3 = N1 + N2;
System.out.println(N1 + "+" + N2 + "=" + N3);
}
}

------------------------------------------------<程式碼結束>--------------------------------------

沒有留言:

張貼留言