使用Java进行 a + b = c 计算

 

 

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;
import java.io.*;
import java.util.*;
public class AaddB {
    public static void main(String[] args)
    {
        int a = 0, b = 0, c =0;
        Scanner input_data = new Scanner(System.in);   
        try
        {
        //  System.out.println("please input a number:\n");
            a = input_data.nextInt();
            b = input_data.nextInt();
            c = a + b;
        //  System.out.println("c = " + c + "\n");
            System.out.println(c);
        }
        catch(Exception e)
        {
            System.out.println("Over the largest number\n");
        }
    }
}

源于:http://www.huiyi8.com/

posted @ 2014-11-13 19:26  乐活人生  阅读(1021)  评论(0编辑  收藏  举报