Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package scuola;
- import java.util.*;
- public class arrray1 {
- public static void main(String[] args) {
- int[] temp = new int [10];
- int tempmin=9999, tempmax=-200, tot= 0, media=0;
- Scanner input = new Scanner (System.in);
- for(int i=0; i<10; i++){
- System.out.println("inserire temperatura");
- temp[i]=input.nextInt();
- }
- for(int i=0; i<10; i++){
- tot+=temp[i];
- }
- for(int i=0; i<10; i++){
- if(temp[i]<tempmin)
- tempmin=temp[i];
- if(temp[i]>tempmax)
- tempmax=temp[i];
- }
- media=tot/10;
- System.out.println("media: "+media);
- System.out.println("temperatura massima: "+tempmax);
- System.out.println("temperatura minima: "+tempmin);
- for(int i=9; i>=0; i--){
- System.out.print(temp[i]+" ");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment