rengetsu

HackerRank_GradingStudents

Jun 18th, 2018
46
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.79 KB | None | 0 0
  1. //Grading Students
  2. #include <iostream>
  3. using namespace std;
  4. int main()
  5. {
  6.     int n, std[100]; // number of students
  7.     cin >> n;
  8.     for(int i=0;i<n;i++)
  9.     {
  10.         cin >> std[i];
  11.         if(std[i]<38)
  12.         {
  13.             cout << std[i] << endl;
  14.         }
  15.         else
  16.         {
  17.            
  18.             for(int a=1;a<21;a++)
  19.             {
  20.                 if((5*a)>=std[i])
  21.                 {
  22.                     if(((5*a)-std[i])<3)
  23.                     {
  24.                         cout << 5*a << endl;
  25.                         break;
  26.                     }
  27.                     else
  28.                     {
  29.                         cout << std[i] << endl;
  30.                         break;
  31.                     }
  32.                 }
  33.             }
  34.         }
  35.     }
  36.     return 0;
  37. }
Add Comment
Please, Sign In to add comment