java sum of two numbers program intellij
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);
}
}import java.util.Scanner;
public class AddTwoNumbers2 {
public static void main(String[] args) {
int num1, num2, sum;
Scanner sc = new Scanner(System.in);
System.out.println("Enter First Number: ");
num1 = sc.nextInt();
System.out.println("Enter Second Number: ");
num2 = sc.nextInt();
sc.close();
sum = num1 + num2;
System.out.println("Sum of these numbers: "+sum);
}
}
Output:
Also in Java:
- unity how to make a gameobject slowly look at a position
- how to create a thread local variable in java
- instantiate optinal java 8
- set password visible in android
- full shutdown windows 10 cmd
- java get keys from hashmap
- java iterate over a string
- crit chance in java
- check last character of string java
- bootstrap center text vertically
- java script removing first three indexes
- arrays.aslist.add
- what is a float java
- islowercase java
- java find duplicates in array
- print arraylist java
- guess the number java
- java search file in folder
- java swing button on click
- how to minimize jframe in java
- java remove duplicates
- how to compare strings java
- how to skip a line in java
- android studio clear views of layout