Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Esercizio1 {
- public static void main(String[] args) {
- int[] V;
- int y=0;
- int somma=0;
- Scanner input = new Scanner(System.in);
- System.out.print("dim");
- int dim=input.nextInt();
- V= new int[dim];
- for(int i=1; i<dim; i++) {
- System.out.print("V["+i+"]=");
- V[i]=input.nextInt();
- if(V[i]%2==0) {
- somma+=V[i];
- y++;
- }
- }
- System.out.println(somma/y);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement