smallest int in java
// min value that an int can store:
Integer.MIN_VALUE
// max value that an int can store:
Integer.MAX_VALUE
// min value that a long can store:
Long.MIN_VALUE
// max value that a long can store:
Long.MAX_VALUE
smallest int in java
// min value that an int can store:
Integer.MIN_VALUE
// max value that an int can store:
Integer.MAX_VALUE
// min value that a long can store:
Long.MIN_VALUE
// max value that a long can store:
Long.MAX_VALUE
difference between greatest and smallest number in java
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int greatest;
int smallest;
System.out.print("Enter three numbers: ");
int num1 = scanner.nextInt();
int num2 = scanner.nextInt();
int num3 = scanner.nextInt();
if(num1 > num2 && num1 > num3)
greatest =num1;
else if(num2 > num1 && num2 > num3)
greatest =num2;
else
greatest = num3;
if(num1 < num2 && num1 < num3)
smallest =num1;
else if(num2 < num1 && num2 < num3)
smallest =num2;
else
smallest = num3;
int difference = greatest - smallest;
System.out.printf("The difference of %d and %d is %d ",greatest,smallest,difference);
}
}
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us