package ff; import java.util.Scanner; // part 1 public class Q1 { static Scanner input = new Scanner(System.in); public static void main(String[] args) { System.out.println("Enter number of apartment : "); int numberofapartment = input.nextInt(); int[] buliding = new int[numberofapartment]; int numberofpeople = 0; for (int i = 0; i < numberofapartment; i++) { System.out.println("Enter number of people in apartment " + (i + 1)); buliding[i] = input.nextInt(); numberofpeople += buliding[i]; } System.out.println("Number of people in the biliding is : " + numberofpeople); double avg = (double) numberofpeople / (double) numberofapartment; System.out.println("AVG= " + avg); int above = 0, below = 0; for (int i = 0; i < numberofapartment; i++) { if (buliding[i] > avg) { above++; } if (buliding[i] < avg) { below++; } } System.out.println("above: " + above + ", below: " + below); } }