WAP in Java to print the sum of two numbers using int sum(int a,int b)
please help
Answers
Answered by
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
English,
25 days ago
Hindi,
25 days ago
Math,
1 month ago
Math,
1 month ago
India Languages,
9 months ago