-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathExercise11.java
More file actions
39 lines (32 loc) · 964 Bytes
/
Exercise11.java
File metadata and controls
39 lines (32 loc) · 964 Bytes
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
35
36
37
38
39
package arrays_exercises;
import java.util.Scanner;
public class Exercise11 {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int[] vet = new int[5];
int soma = 0;
int mul = 1;
for (int i = 0; i < vet.length; ++i) {
System.out.println("Digite um numero inteiro: ");
vet[i] = in.nextInt();
soma += vet[i];
mul *= vet[i];
}
System.out.println("\nNumeros digitados: ");
for (int j = 0; j < vet.length; ++j) {
System.out.println(vet[j]);
}
System.out.println("\nSoma total dos numeros digitados: ");
for (int j = 0; j < vet.length; ++j) {
System.out.println(soma);
}
System.out.println("\nMultiplicacao total dos numeros digitados: ");
for (int j = 0; j < vet.length; ++j) {
System.out.println(mul);
}
in.close();
}
}
/*Faça um Programa que leia um vetor de 5 números inteiros, mostre a soma, a
multiplicação e os números.
*/