# Java: Accepts three integers and check whether sum of the first two given integers is greater than third one

## Java Basic: Exercise-247 with Solution

Write a Java program that accepts three integers and checks whether the sum of the first two integers is greater than the third integer. Three integers are in the interval [-2^{31}, 2^{31} ].

**Visual Presentation: **

**Sample Solution:**

**Java Code:**

```
// Importing Scanner class for user input
import java.util.Scanner;
// Defining a class named "Main"
public class Main {
// Main method, the entry point of the program
public static void main(String[] args) {
// Creating a Scanner object for reading user input
Scanner in = new Scanner(System.in);
// Prompting the user to input three integers (a, b, c)
System.out.println("Input three integers (a, b, c):");
// Reading long integers a, b, and c from the user
long a = in.nextLong();
long b = in.nextLong();
long c = in.nextLong();
// Prompting the user with a message
System.out.println("Check whether (a + b) is greater than c?");
// Checking and printing whether the sum of a and b is greater than c
System.out.println(a + b > c);
}
}
```

Sample Output:

Input three integers (a,b,c): 5 8 9 Check whether (a + b) is greater than c? true

**Flowchart: **

**Java Code Editor:**

** Contribute your code and comments through Disqus.**

**Previous:** Write a Java program to convert 3 digits positive number in above format. For example, 234 should be output as BBSSS1234 because it has 2 "hundreds", 3 "ten", and 4 of the ones.

**Next:** Write a Java program to check if each letter of a given word is less than the one before it.

**What is the difficulty level of this exercise?**

Test your Programming skills with w3resource's quiz.

**Weekly Trends and Language Statistics**- Weekly Trends and Language Statistics