Created
November 5, 2018 10:56
-
-
Save feynon/b8c78ceb1685479d20640a9b2e7992a7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <math.h> | |
#include <stdio.h> | |
#include <string.h> | |
#include <stdlib.h> | |
#include <assert.h> | |
#include <limits.h> | |
#include <stdbool.h> | |
using namespace std; | |
int gradingStudents(int n,int a[]){ | |
int temp; | |
for(int i=0;i < n;i++){ | |
if(a[i]>38 && a[i] % 5 != 0){ | |
temp = a[i]; | |
do{ | |
temp++; | |
} | |
while(temp % 5== 0); | |
if(temp - a[i] < 3){ | |
a[i] = temp; | |
} | |
} | |
else{ | |
temp = a[i]; | |
} | |
} | |
return temp; | |
} | |
int main(){ | |
int n; | |
scanf("%d",& n); | |
int a[n]; | |
for(int i=0;i<n;i++){ | |
scanf("%d",& a[i]); | |
} | |
printf("%n",gradingStudents(n,a)); //Only name of an array is passed as an argument | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment