# Grading Students HackerRank Solution in C, C++, Java, Python

HackerLand University has the following grading policy:

• Every student receives a grade in the inclusive range from 0 to 100.

Sam is a professor at the university and likes to round each student’s grade according to these rules:

• If the difference between the grade and the next multiple of 5 is less than 3, round grade up to the next multiple of 5.
• If the value of grade is less than 38, no rounding occurs as the result will still be a failing grade.

Examples

•  grade = 84 round to 85 (85 – 84 is less than 3)
•  grade = 29 do not round (result is less than 40)
•  grade do not round (60 – 57 is 3 or higher)

Given the initial value of  for each of Sam’s  students, write code to automate the rounding process.

Function Description

Complete the function gradingStudents in the editor below.

Returns

• int[n]: the grades after rounding as appropriate

Input Format

The first line contains a single integer,n, the number of students.

Each line i of the n subsequent lines contains a single integer, grade[i].

Constraints

• 1<=n<=60

Sample Input 0

```4

73

67

38

33```

Sample Output 0

```75

67

40

33```

## Grading Students HackerRank Solution in C

```#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
#include <limits.h>
#include <stdbool.h>

int main(){
int n;
scanf("%d",&n);
for(int a0 = 0; a0 < n; a0++){
x *= 5;
}
return 0;
}```

## Grading Students HackerRank Solution in C++

```#include <map>
#include <set>
#include <list>
#include <cmath>
#include <ctime>
#include <deque>
#include <queue>
#include <stack>
#include <string>
#include <bitset>
#include <cstdio>
#include <limits>
#include <vector>
#include <climits>
#include <cstring>
#include <cstdlib>
#include <fstream>
#include <numeric>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <unordered_map>

using namespace std;

int main(){
int n;
cin >> n;
for(int a0 = 0; a0 < n; a0++){
int rem = grade % 5;
if (rem >= 3) grade += 5 - rem;
}
}
return 0;
}```

## Grading Students HackerRank Solution in Java

```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) {
Scanner in = new Scanner(System.in);
int n = in.nextInt();
for(int a0 = 0; a0 < n; a0++){
}
else{
if(rem >= 3){
System.out.println((q+1)*5);
}
else{
}
}
}
}
}```

## Grading Students HackerRank Solution in Python

```#!/bin/python

import sys

n = int(raw_input().strip())
for a0 in xrange(n):
continue
if grade % 5 >= 3:

## Grading Students HackerRank Solution in C#

```using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
class Solution {

static void Main(String[] args) {
for(int a0 = 0; a0 < n; a0++){
int final = 0;
int next = ((grade / 5) + 1) * 5;