-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path14.java
34 lines (22 loc) · 999 Bytes
/
14.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
/*******************************************************************************
* 14) Escreva um programa que leia dois números e apresente a diferença do
* maior para o menor.
*******************************************************************************/
import java.util.Scanner;
public class Exercicio {
public static void main(String[] args) {
Scanner entrada = new Scanner(System.in);
int PrimeiroNumero, SegundoNumero, Diferenca;
System.out.print("Verificador de números\n\n");
System.out.print("Digite o primeiro número: ");
PrimeiroNumero = entrada.nextInt();
System.out.print("Digite o segundo número: ");
SegundoNumero = entrada.nextInt();
if(PrimeiroNumero >= SegundoNumero){
Diferenca = PrimeiroNumero - SegundoNumero;
}else{
Diferenca = SegundoNumero - PrimeiroNumero;
}
System.out.println("\nA diferença do menor para o menor é "+Diferenca);
}
}