-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathLista2 PEOO #8
26 lines (25 loc) · 1.03 KB
/
Lista2 PEOO #8
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
using System;
class MainClass {
public static void Main (string[] args) {
Console.WriteLine ("Digite quatro valores inteiros");
int a = int.Parse(Console.ReadLine());
int b = int.Parse(Console.ReadLine());
int c = int.Parse(Console.ReadLine());
int d = int.Parse(Console.ReadLine());
int maior = 0;
int menor = 0;
if (a == b || a == c || a == d || b == c || b == d || c == d) Console.WriteLine("Não foi possível fazer a operação pois alguns valores são iguais");
if (a > b && a > c && a > d) maior += a;
if (b > a && b > c && b > d) maior += b;
if (c > b && c > a && c > d) maior += c;
if (d > b && d > c && d > a) maior += d;
if (a < b && a < c && a < d) menor += a;
if (b < a && b < c && b < d) menor += b;
if (c < b && c < a && c < d) menor += c;
if (d < b && d < c && d < a) menor += d;
int soma = (a + b + c + d) - (maior + menor);
Console.WriteLine($"Maior valor = {maior}");
Console.WriteLine($"Menor valor = {menor}");
Console.WriteLine($"{soma}");
}
}