首页 > 代码库 > 使用Java进行 a + b = c 计算

使用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 = http://www.mamicode.com/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/

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