Advertisement
Guest User

really cool java code that i'm proud of

a guest
Jan 28th, 2020
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.93 KB | None | 0 0
  1. import java.util.Scanner;
  2. public class Main {
  3.     public static void main (String args[]) {
  4.         Scanner scan = new Scanner (System.in);
  5.             System.out.println("Enter an integer to put in between two other integers.");
  6.                 int a = scan.nextInt();
  7.             System.out.println("Enter a second and a third integer to put the first integer in between.");
  8.                 int b = scan.nextInt();
  9.                 int c = scan.nextInt();
  10.                     if (b > c) {
  11.                         System.out.println("The second integer cannot be greater than the third. Please try again.");
  12.                         }
  13.                     else if (b < a && a < c) {
  14.                         System.out.println(a + " is between " + b + " and " + c + ".");
  15.                         }
  16.                     else {
  17.                         System.out.println(a + " is not between " + b + " and " + c + ".");
  18.         }
  19.     }
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement