Turbo Task

Description:

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 completes the task first will be rewarded. Write a 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 Inputs correspond 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. [All text in bold corresponds to input and the rest corresponds to output] Test Case 1 Input (stdin) 10 5 6 4 Expected Output Third person wins Test Case 2 Input (stdin) 4 9 6 7 Expected Output No person wins

Program :

#include <stdio.h>

int main ()

{

  int r,a,b,c;

  scanf ("%d%d%d%d",&r,&a,&b,&c);

  if (r>a&&a<b&&a<c)

  {

  printf ("First person wins");

}

else if (r>b&&b<a&&b<c)

{

  printf ("Second person wins");

}

else if (r>c&&c<a&&b)

{

  printf ("Third person wins");

}

else

{

  printf ("No person wins");

}

return 0;

}