TUBE AND AGE ID-3468
A game is conducted with ‘n’ players. Given the name, age and size of tube with each player and a player name ‘p’, write an algorithm and the C program to print name of all the players who can be partner of the player ‘p’. A player ‘q’ can be partner of player ‘p’ if the age of ‘q’ is less than player ‘p’ and tube size of player ‘q’ is greater than tube size of player ‘p’.

For example, given details of five salespersons as follows:
Name13415
Name22312
Name3459
Name41934
Name53214
And player ‘p’ name as Name1. Name of players who can be partner of player ‘p’ are Name2, Name5.

Input Format
First line contains the number, n
Next n lines contain details of ‘n’ players such as name, age and size in order and separated by space
Next line contains the name of the player, p

Output Format
Print all the name of players with age less than age of player p and tube size less than tube size of player p
SOL:-
C-CODE:

#include<stdio.h>
#include<string.h>
struct details
{char a[50];
  int age,size;};
void main()
{  int n,i,j;
    char p[50];
    scanf("%d",&n);
    struct details b[n]; 
    for(i=0;i<n;i++) {
        scanf("%s",b[i].a);
        scanf("%d",&b[i].age);
        scanf("%d",&b[i].size);}
    scanf("%s",p);   
    for(i=0;i<n;i++){
        if(strcmp(b[i].a,p) == 0) {
            j = i;
            break;}}
        for(i=0;i<n;i++){
        if((b[i].age < b[j].age) && (b[i].size < b[j].size)){
            printf("%s\n",b[i].a);
        }}}