Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package exercicios;
- import java.util.Scanner;
- public class ex8 {
- public static void main(String[] args) {
- Scanner sc = new Scanner(System.in);
- int num,soma = 0,media;
- for(int i = 0 ; i< 5; i++){
- System.out.println("Digite o número: ");
- num = sc.nextInt();
- soma += num;
- }
- media = soma /5;
- System.out.println("Soma: "+soma+"\nMedia: "+media);
- }
- /* César N. */
- }
- //faça um programa que leia 5 numeros e informe a soma e a media dos numeros
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement