From 736ed7913e7594ada8a423dd585af698eb3daad3 Mon Sep 17 00:00:00 2001 From: Janssen Batista Date: Sat, 6 May 2023 13:30:10 -0300 Subject: [PATCH] update Ex3_MaiorEMedia --- .idea/jpa-buddy.xml | 6 ++++++ .idea/misc.xml | 6 +++--- .idea/runConfigurations.xml | 10 ---------- src/br/com/dio/exercicios/loops/Ex3_MaiorEMedia.java | 7 +++---- 4 files changed, 12 insertions(+), 17 deletions(-) create mode 100644 .idea/jpa-buddy.xml delete mode 100644 .idea/runConfigurations.xml diff --git a/.idea/jpa-buddy.xml b/.idea/jpa-buddy.xml new file mode 100644 index 0000000..966d5f5 --- /dev/null +++ b/.idea/jpa-buddy.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml index 3afb4ee..6723f11 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,12 +1,12 @@ - - - + + \ No newline at end of file diff --git a/.idea/runConfigurations.xml b/.idea/runConfigurations.xml deleted file mode 100644 index 797acea..0000000 --- a/.idea/runConfigurations.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/src/br/com/dio/exercicios/loops/Ex3_MaiorEMedia.java b/src/br/com/dio/exercicios/loops/Ex3_MaiorEMedia.java index d2aa6e9..ed6b595 100644 --- a/src/br/com/dio/exercicios/loops/Ex3_MaiorEMedia.java +++ b/src/br/com/dio/exercicios/loops/Ex3_MaiorEMedia.java @@ -12,7 +12,7 @@ public static void main(String[] args) { Scanner scan = new Scanner(System.in); int numero; - int maior = 0; + int maior = Integer.MIN_VALUE; int soma = 0; int count = 0; @@ -20,11 +20,10 @@ public static void main(String[] args) { System.out.println("NĂºmero: "); numero = scan.nextInt(); - soma = soma + numero; - + soma += numero; if (numero > maior) maior = numero; - count = count + 1; + count++; } while(count < 5); System.out.println("Maior: " + maior);