Computer Science, asked by Anonymous, 1 month ago

WAP in Java to print the sum of two numbers using int sum(int a,int b)

please help​

Answers

Answered by Anonymous
1

Answer:

//Program to print the sum of two numbers in java using int sum(int a, int b)

class SumOf2Numbers

{

   public static int sum(int a, int b)

    {

         //Declaration

         int sum;

         

          //Computation

          sum = a + b;

          //Return the result

          return sum;

       }

       public static void main(String[] args)

       {

            int sumOf_AandB;

            sumOf_AandB = sum(5, 10);

            System.out.println("The sum is =  " + sum);

        }

}

Similar questions