1 solutions

  • 0
    @ 2024-12-10 19:30:27

    C :

    #include <stdio.h>
    int main()
    {
    	int a,b;
    	while(scanf("%d%d",&a,&b)!=EOF)
    	{
    		printf("%d\n",a+b);
    	}
    	return 0;
    }
    

    C++ :

    #include <iostream>
    #include <cstdio>
    using namespace std;
    int main()
    {
    #ifndef ONLINE_JUDGE
    	freopen("in.txt","r",stdin);
    #endif
    	int a,b;
    	while(cin >>a >>b)
    	{
    		cout <<a+b <<endl;
    	}
    	return 0;
    }
    

    Pascal :

    program abprob;
    var
      a,b:longint;
    begin
       readln(a,b);
       writeln(a+b);
    end.
    

    Java :

    import java.util.*;
    public class Main
    {
    	public static void main(String args[])
    	{
    		Scanner cin = new Scanner(System.in);
    		int a,b;
    
    		while(cin.hasNextInt())
    		{
    			a = cin.nextInt();
    			b = cin.nextInt();
    			System.out.println(a+b);
    		}
    	}
    }
    

    PHP :

    <?php
    $input = stream_get_contents(STDIN);
    list($a, $b) = explode(' ', $input);
    echo $a + $b;
    
    

    Fortran :

    PROGRAM P1000
    			
    IMPLICIT NONE
    INTEGER :: A, B
     
    READ(*,*) A, B
    WRITE(*, '(I0)') A + B
     
    END PROGRAM P1000
    		
    

    JavaScript :

    process.stdin.resume();
    process.stdin.setEncoding('utf-8');
    var input = "";
    var input_array = "";
    process.stdin.on('data', function (data) {
        input += data;
    });
    function solveMeFirst(a, b) {
        return a + b;
    }
    process.stdin.on('end', function () {
        var arr = input.split("\n");
        for (var i=0; i<arr.length; i++) {
                                    input_array=arr[i].split(" ");
    
                var inline = 0;
                var res;
                var _a = parseInt(input_array[inline], 10);
                inline += 1;
    
                var _b = parseInt(input_array[inline], 10);
                inline += 1;
    
                res = solveMeFirst(_a, _b);
                if(!isNaN(res) )process.stdout.write( res + "\n");
        }
    });
    
    

    Go :

    package main
    import "fmt"
    import "io"
    func main() {
      a:=0
      b:=0
      for {
      	_, err := fmt.Scanf("%d%d",&a,&b)
      	if err == io.EOF {
      		break
      	} else {
    		fmt.Printf("%d\n",a+b)
    	}
      }
    }
    
    • 1

    Information

    ID
    9317
    Time
    1000ms
    Memory
    256MiB
    Difficulty
    (None)
    Tags
    # Submissions
    0
    Accepted
    0
    Uploaded By