🔥 Burn Fat Fast. Discover How! 💪

import java.io.*; import java.util.*; import java.text.*; impo | 🅲🅰🆁🅴🅴🆁 🆂🆃🆄🅳🅸🅾

import java.io.*;
import java.util.*;
import java.text.*;
import java.math.*;
import java.util.regex.
public class Solution {
public static void main(String args[] ) throws Exception {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
Student[] s = new Student[n];
for(int i = 0; i < n; i++) {
int id = sc.nextInt();
sc.nextLine();
String name = sc.nextLine();
double marks = sc.nextDouble();
int age = sc.nextInt();
s[i] = new Student(id, name, marks, age);
}
double m = sc.nextDouble();
Student s1 = searchStudentByAge(s, m);
if(s1 == null) {
System.out.println("No Student found with mentioned age.");
} else {
System.out.println("id-"+s1.getId());
System.out.println("name-"+s1.getName());
System.out.println("marks-"+s1.getMarks());
System.out.println("age-"+s1.getAge());
}
Student s2 = findStudentWithMinimumMarks(s);
if(s2 == null) {
System.out.println("No Student found with mentioned age.");
} else {
System.out.println("id-"+s2.getId());
System.out.println("name-"+s2.getName());
System.out.println("marks-"+s2.getMarks());
System.out.println("age-"+s2.getAge());
}

}

public static Student searchStudentByAge(Student[] s,double marks){
int l = s.length;
for(int i = 0; i < l; i++) {
if(marks == s[i].getAge()) return s[i];
}
return null;
}

public static Student findStudentWithMinimumMarks(Student[] s){
double min = s[0].getMarks();
Student s1 = null;
for(int i = 0; i < s.length; i++) {
if(s[i].getMarks() <= min) {
min = s[i].getMarks();
s1 = s[i];
}
}
return s1;
}
}
class Student {
int id;
String name;
double marks;
int age;
Student(int id, String name, double marks, int age) {
this.id = id;
this.name = name;
this.marks = marks;
this.age = age;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String Name) {
this.name = name;
}
public double getMarks() {
return marks;
}
public void setMarks(double marks) {
this.marks = marks;
}
public int getAge() {
return age;
}
public void setAge(int age) {
this.age = age;
}
}

TCS PRA JAVA code

@thecareerstudio