111k views
5 votes
Write a java program that will accept two integer values from the key board, sum this values and then print the message the summation is greater then 10 if true otherwise the summation is less then 10

User Eolith
by
6.8k points

1 Answer

3 votes

import java.util.Scanner;

public class Summary {

public static void main(String[] args) {

Scanner scanner = new Scanner(System.in);

int num1 = scanner.nextInt();

int num2 = scanner.nextInt();

int sum = num1 + num2;

if (sum > 10) {

System.out.println("The summation is greater than 10.");

} else {

System.out.println("The summation is less than or equal to 10.");

}

}

}

User Dgnorton
by
8.2k points

No related questions found