You are on page 1of 3
Lab#H07: Open Ended Lab LAB7 OPEN ENDED Objective Simulate game. The game involves a number of children, and you are supposed to read their names from any appropriate data structure. The children whose names are on index numbered by prime numbers should be placed on the first list, and the others on the second list. Every mth child, where m is the number of elements in the first list is eliminated from that list. Counting goes on with the next child. Repeat this Counting m times or til the second list gets empty. Your program should output the initial lists and the final second list SOURCE CODE: import java.util Scanner; Public class JavaApplication10 { Static boolean Prime(int n) { if(n<=1){ return false; y for (int i= 2; i0; if (n/2==0){ return true; } } return true; } public static void main(Stringl] args) { String arr] = new String{ 100}; int n = 10; System.out printin("Enter any Names: Scanner sc = new Scanner(System.in js b< ny i+) { c.nextLine(); for (int arefi] } CE-205: Data Structures and Algorithms Lab#07: Open Ended Lab ‘System.out.printin("Prime 7 Children are: for (inti = 4; i

You might also like