Addition of two numbers

import java.util.*;
class Add
{
    public static void main(String args[])
    {
        int a,b,sum;
        Scanner sc = new Scanner(System.in);
        System.out.println("Enter two number:");
        a=sc.nextInt();
        b=sc.nextInt();
        sum=add(a,b);
        System.out.println("The Sum is "+sum);
    }
    static int add (int x,int y)
    {
        return(x+y);
    }
}

No comments :

Post a Comment