Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
1.0 kB
4
Indexable
Never
import java.util.Scanner;

public class EventAttendance {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        
        System.out.print("Enter the total number of people attending the event: ");
        int totalAttendees = scanner.nextInt();
        
        System.out.print("Enter the number of groups: ");
        int numGroups = scanner.nextInt();
        
        int[] groupSizes = new int[numGroups];
        
        for (int i = 0; i < numGroups; i++) {
            System.out.print("Enter the size of group " + (i + 1) + ": ");
            groupSizes[i] = scanner.nextInt(); 

        }
        
        System.out.println("Total Attendees: " + totalAttendees);
        System.out.println("Number of Groups: " + numGroups);
        System.out.println("Group sizes:");
        for (int i = 0; i < numGroups; i++) {
            System.out.println("Group " + (i + 1) + ": " + groupSizes[i]);
        }
        
        scanner.close();
    }
}