A Plus B - Simple


Submit solution

Points: 2 (partial)
Time limit: 1.0s
Memory limit: 64M

Author:
Problem type

題目說明

簡單加法

輸入

兩個數字

輸出

兩個數字相加的總和

範例輸入 #1

1 
1

範例輸出 #1

2

範例輸入 #2

3 
100

範例輸出 #2

103

範例輸入 #3

-1 
 1

範例輸出 #3

 0

Comments


  • 0
    scu13156156  commented on Sept. 27, 2024, 3:47 p.m.

    import java.util.Scanner;

    public class W3HW1 {

    public static void main(String[] args) {
        // TODO Auto-generated method stub
        int a=0,b=0,c=0,d=0;
        Scanner scan = new Scanner(System.in);
        a= scan.nextInt();
        b= scan.nextInt();
        c=a+b;
        System.out.print(""+c);
    
    }

    }


  • 0
    scu13156142  commented on Sept. 25, 2024, 10:41 p.m.

    public static void main(String[] args) { // TODO Auto-generated method stub Scanner scan = new Scanner(System.in); int a=0, b=0, sum=0; a = scan.nextInt(); b = scan.nextInt(); sum = a+b; System.out.println(sum);