Code:
#include<stdio.h>
int main()
{
int time,t[3];
printf("Enter the Time Limit:\n");
scanf("%d",&time);
printf("Enter the time taken by the first person:\n");
scanf("%d",&t[0]);
printf("Enter the time taken by the second person:\n");
scanf("%d",&t[1]);
printf("Enter the time taken by the third person:\n");
scanf("%d",&t[2]);
if((t[0]<t[1])&&(t[0]<t[2]))
{
if(t[0]<time)
printf("First person wins!!!");
else
printf("No person wins:-(");
}
else if((t[1]<t[0]))
{
if (t[1]<time)
printf("Second person wins!!!");
else
printf("No person wins:-(");
}
else
if(t[2]<time)
{
printf("Third person wins!!!");
}
else
printf("No person wins:-(");
return 0;
}
No comments