Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Main {
- public static void main (String args[]) {
- Scanner scan = new Scanner (System.in);
- System.out.println("Enter an integer to put in between two other integers.");
- int a = scan.nextInt();
- System.out.println("Enter a second and a third integer to put the first integer in between.");
- int b = scan.nextInt();
- int c = scan.nextInt();
- if (b > c) {
- System.out.println("The second integer cannot be greater than the third. Please try again.");
- }
- else if (b < a && a < c) {
- System.out.println(a + " is between " + b + " and " + c + ".");
- }
- else {
- System.out.println(a + " is not between " + b + " and " + c + ".");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement