June 14, 2017
Problem : Student having grade > 37 needs to be rounded to next multiple of 5 if difference b/w next multiple and number is less than 3.
static int[] solve(int[] grades){
for(int i=0;i<grades.length;i++)
{
if(grades[i]>37 && (5-grades[i]%5)<3)
{
grades[i]+=(5-grades[i]%5);
}
}
return grades;
}
0 Comments:
Post a Comment