A task is given to 3 persons to complete it within a particular time. If the person exceeds the time limit he will be disqualified . Only those who complete it within the given time limit is qualified. Among the qualified persons. the person who complete the task first will be rewarded.Write a C program to find the person who is rewarded. Input Format: First Input corresponds to the time limit for the task in hours . Second, third and fourth input corresponds to the number of hours taken by the first, second and third persons respectively to complete the task. Output format: Display the person who completes first. 5 4 4 1 Third person wins!! 4 1 2 3 First person wins!! Test Case 1 Input (stdin) 10 5 4 7 Expected Output Second person wins!! Test Case 2 Input (stdin) 4 9 6 7 Expected Output No person wins!!

Program :

  • #include <stdio.h>
    int main()
      int t,a,b,c;
      scanf("%d %d %d",&a,&b,&c);
      if(a>t && b>t && c>t)
        printf("No person wins!!");
      else if(a<t && a<b && a<c)
        printf("First person wins!!");
      else if(b<t && b<a && b<c)
        printf("Second person wins!!");
        printf("Third person wins!!");

    return 0;