Answers for "simple example of adding two number by calling a method"

0

simple example of adding two number by calling a method

import java.util.Scanner;
class SumMethod{
public static void main(String args[]){
Scanner sc=new Scanner(System.in);
System.out.print("Enter the first number: ");
int num1=sc.nextInt();
System.out.print("Enter the second number: ");
int num2=sc.nextInt();
sc.close();
Sum(num1,num2); 
}
//Sum method
public static void Sum(int num_A,int num_B){
int sum=0;
sum=num_A+num_B;
System.out.println("Sum of two numbers  "+sum);
}
}
Posted by: Guest on April-10-2022

Code answers related to "simple example of adding two number by calling a method"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language