Students in a class have been assigned a unique ID. As part of a quiz competition, the class teacher wishes to form two different groups from the N number of students who are participating in the quiz. All participants are currently sitting in a random manner, but teacher wishes all of them to sit according to their IDs. Two groups will be formed in such a way that students whose seat number is an odd number will be in the first group and students whose seat number is an even number will be in the second group. Write an algorithm to find the list of which student IDs should be in the first group, followed by the student IDs which should be in the second group as per the teacher's instructions. Input The first line of the input consists of an integer - numStudents, representing the number of students participating in the quiz(N). The next lines consist of N space-separated integers - studID1, stud!Dz....studiDn, representing student IDs for all the participants. Output Print N space-separated integers representing the student IDs of first group followed by the student IDs of the second group. Constraints 1 s num Students < 103 1 s studID s 103 1 sis num Students
Answers
Answer:
OK I will solve this problem
Explanation:
OK OK I will solve this problem
Answer:
The first line of the input consists of an integer - num Students, representing the number of students participating in the quiz(N).
The next lines consist of N spate-separated IDs.
Explanation:
import java.util.Scanner;
public class abc
{
public static void main(String[] args)
{
Scanner scan = new Scanner(System.in);
System.out.println("Please enter a student ID between 6-10 digits");
String nums = scan.nextLine();
String[] studentIdArray = nums.split(" ");
int[] studentID = new int [studentIdArray.length];
for (int i = 0; i < studentIdArray.length; i++)
{
studentID[i]= Integer.parseInt(studentIdArray[i]);
System.out.print(studentID[i] + ",");
}
}
The project code is #SPJ3