Write a Modular C Programming code to find out the efficiency of the worker
In a company, worker efficiency is determined on the basis of the time required for a worker to complete a particular job. If the time taken by the worker is between 2-3 hours, then the worker is said to be highly efficient. If the time required by the worker is between 3-4 hours, then the worker is ordered to improve speed. If the time taken is between 4-5 hours, the worker is given the training to improve his speed, and if the time taken by the worker is more than 5 hours, then the worker is terminated.
The time taken by the worker is input through the keyboard; write a c program to find the efficiency of the worker.
Input Format
time to complete a job in hours and minutes (hh mm).
Constraints
0<=hh<=24 0<=mm<=59
Output Format
print work efficiency of worker
Sample Input 0
2 00
Sample Output 0
highly efficient
Sample Input 1
3 40
Sample Output 1
improve speed
Sample Input 2
4 45
Sample Output 2
training to improve speed
Sample Input 3
5 15
Sample Output 3
terminated
Sample Input 4
25 25
Sample Output 4
Invalid time
Refer : C Programming HackerRank all solutions for Loops | Arrays | strings
CODE:
#include<stdio.h> #include<stdlib.h> #include<string.h> #include<math.h> int main() { int h,m; scanf("%d%d",&h,&m); if(h>=0&&h<=24&&m>=0&&m<=59) { if(h>=2&&h<3&&m>=0&&m<=59) printf("highly efficient"); else if(h>=3&&h<4&&m>=0&&m<=59) printf("improve speed"); else if(h>=4&&h<5&&m>=0&&m<=59) printf("training to improve speed"); else printf("terminated"); } else printf("Invalid time"); }
OUTPUT
Congratulations, you passed the sample test case. Click the Submit Code button to run your code against all the test cases. Input (stdin) 2 00 Your Output (stdout) highly efficient Expected Output highly efficient
Please find some more codes of Loops, Condition Statements, 1D Arrays, 2D Arrays, Strings, Pointers, Data Structures, Files, Linked lists, MISC, Solved model question papers & Hacker Rank all solutions on the below page:
Top 100+ C Programming codes – KLE Technological University