You are viewing a single comment's thread. Return to all comments →
From my HackerRank solutions.
import java.util.Scanner; public class Solution { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int n = scan.nextInt(); while (n-- > 0) { int grade = scan.nextInt(); System.out.println(roundGrade(grade)); } } private static int roundGrade(int grade) { if (grade >= 38) { int gradeMod5 = grade % 5; if (gradeMod5 > 2) { grade += 5 - gradeMod5; } } return grade; } }
Let me know if you have any questions.
Seems like cookies are disabled on this browser, please enable them to open this website
Grading Students
You are viewing a single comment's thread. Return to all comments →
Java solution - passes 100% of test cases
From my HackerRank solutions.
Let me know if you have any questions.