Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(added grading students question from hackerrank) #409

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions Task 1/Grading_students/question.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
HackerLand University has the following grading policy:

Every student receives a in the inclusive range from to .
Any less than is a failing grade.
Sam is a professor at the university and likes to round each student's according to these rules:

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

Binary file added Task 1/Grading_students/solution
Binary file not shown.
31 changes: 31 additions & 0 deletions Task 1/Grading_students/solution.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#include<iostream>
#include<bits/stdc++.h>

using namespace std ;

int main(){
int n , i;
//cout<<"enter the number of students :: ";
cin>>n;

int g[n];
for(i=0;i<n;i++){
cin>>g[i];
}

for(i=0;i<n;i++){
if(g[i]>=38){
if((g[i]%5)==3){
g[i]=g[i]+2;
}
if((g[i]%5==4)){
g[i]=g[i]+1;
}
}
}

for(i=0;i<n;i++){
cout<<g[i]<<endl;
}
return 0;
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please do add a newline at EOF