Java program that reads in three integers and prints "in order" if they are sorted in ascending or descending order, or "not in order" otherwise
###### Posted by Samath
Last Updated: February 12, 2021

Write a program that reads in three integers and prints "in order" if they are sorted in ascending or descending order, or "not in order" otherwise. For example,
1 2 5 in order
1 5 2 not in order
5 2 1 in order
1 2 2 in order

Code:

```import java.util.Scanner;

public class Main
{
public static void main(String[] args) {

double num1;
double num2;
double num3;

Scanner input = new Scanner(System.in);

System.out.println("Enter first number: ");
num1 = input.nextDouble();

System.out.println("Enter second number: ");
num2 = input.nextDouble();

System.out.println("Enter third number: ");
num3 = input.nextDouble();

if ((num1 <= num2  && num2 < num3) || (num1 < num2 && num2 <= num3) || (num1 > num2 && num2 >= num3) || (num1 >= num2 && num2 > num3))
{
System.out.println("In order");
}
else
{
System.out.println("Not in order");
}
input.close();
}

}
```
###### JavaScript program that sort an array of integers in ascending order
SceDev | Feb 17, 2024
###### C program that prompts the user for an input string, sorts its characters, and prints out the sorted output
Samath | May 04, 2016
###### C program that sort a list of number in non-ascending order and print the midpoint of the list
Samath | Jun 01, 2015
###### C Program to Read integers into an array and Reversing them using Pointers
Samath | Jan 02, 2017
###### Java program that prints the sum of the first ten positive integers
Samath | Jan 08, 2021
###### Java program that prints the product of the first ten positive integers
Samath | Jan 08, 2021
###### C++ program that adds, subtracts, multiplies, or divides two integers
Samath | Nov 04, 2014
###### C program that takes two integers as command line arguments and divide the first argument by the second argument
Samath | May 04, 2016
###### Java program that reads four integers and prints "two pairs" if the input consists of two matching pairs and "not two pairs" otherwise
Samath | Feb 12, 2021
###### C++ program that prompts the user to input five decimal numbers, prints the five decimal numbers, converts each decimal number to the nearest integer, adds the five integers and prints the sum and average of the five integers.
Samath | Apr 06, 2022