/******************************************************************************
Online C Compiler.
Code, Compile, Run and Debug C program online.
Write your code in this editor and press "Run" button to compile and execute it.
*******************************************************************************/
/*C program to read participants name, finish time and gender and choose the winner being either male or female*/
#include <stdio.h>
#include <string.h>
struct part
{
char name[100];
int t;
char gen[10];
};
int main()
{
struct part p[3],s;
int i,j,k;
for(i=0;i<3;i++)
{
printf("enter name of the particients") ;
scanf("%s",p[i].name);
printf("enter finish time");
scanf("%d",&p[i].t);
printf("enter gender");
scanf("%s",p[i].gen);
}
for(i=0;i<3;i++)
{
printf("%s ",p[i].name);
printf("%d ",p[i].t);
printf("%s ",p[i].gen);
printf("\n");
}
s.t=p[1].t;
for(i=0;i<3;i++)
if(p[i].t<s.t)
{
strcpy(s.name,p[i].name);
strcpy(s.gen,p[i].gen);
s.t=p[i].t;
}
printf("winner is %s time taken=%d %s",s.name,s.t,s.gen);
return 0;
}