public class main{
public static void main(String [] args){
int num1 = 1;
int num2 = 5;
int result = num1 + num2;
}
}
import java.util.*;
public class Add
{
public static void main(String[] args)
{
Scanner sc=new Scanner(System.in);
System.out.println("Enter 2 numbers");
num1=sc.nextInt();
num2=sc.nextInt();
int sum=num1+num2;
System.out.println("The sum of the two numbers is: "+sum);
}
}
public class AddTwoNumbers {
public static void main(String[] args) {
int num1 = 5, num2 = 15, sum;
sum = num1 + num2;
System.out.println("Sum of these numbers: "+sum);
}
}
Output:
Sum of these numbers: 20
public class Rohit {
public static void main (String[]args){
int a=5;
int b=6;
int sum =a+b;
System.out.println("The sum is: "+sum);
}
}
public class Rohit2 {
public static void main (String[]args){
int a=5;
int b=6;
int sum =a+b;
System.out.println("The sum is: "+sum);
}
}
public class Rohit2 {
public static void main (String[]args){
int a=5;
int b=6;
int sum =a+b;
System.out.println("The sum is: "+sum);
}
}