Learning coding means GreatToCode Be more than a Coder ! Greattocode , Join GreatToCode Community,1000+ Students Trusted On Us .If You want to learn coding, Then GreatToCode Help You.No matter what It Takes !


CODE YOUR WAY TO A MORE FULFILLING And HIGHER PAYING CAREER IN TECH, START CODING FOR FREE Camp With GreatToCode - Join the Thousands learning to code with GreatToCode
Interactive online coding classes for at-home learning with GreatToCode . Try ₹Free Per Month Coding Classes With The Top Teachers . ADVANCE C TUTORIALS

ADVANCE C TUTORIALS

 ADVANCE C TUTORIALS 

__________________________________________________________________________

Write a C program to accept details of n students (roll number,

name,percentage) using structure. Display details of the

student having maximum percentage.

_____________________________________________________________

#Include <studio.h>

#Include <conio.h>

struct stud{char name [30];

       int mark;

       }s[5];

void main ()

{

int i ,max ,n;

clrscr();

      printf("\n enter name and mark of 3 students\n ");

         for (i=0;i<3;i++)

           {

  printtf ( "Name:");

  fflush(stdin);

   gets (s[i].name);

    fflush(stdin);

   printf("marks :");

fflush(stdin);

    scanf("%d" ,&s[i].mark);

}

  max=s[0].mark;

for(i=0;i<3;i++)

{

 if (max<s[i].mark)

{

  max=s[i].mark;

  n=i;

  }

}

 printf (" name and mark of the 3 student");

  for(i=0;i<3;i++)

 {

  printf("\n");

   printf("%s marks ", s[i].name);

printf(": %d", s[i].mark);

  }

printf("\n\n Topper is ");

   printf("%s marks ", s[n].name);

  printf(": %d",s[n].mark);

getch();


}





Post a Comment

0 Comments

•Give The opportunity to your child with GreatToCode Kid's • Online Coding Classes for Your Kid • Introduce Your kid To the world's of coding
•Fuel You Career with our 100+ Hiring Partners, Advance Your Career in Tech with GreatToCode. •Join The Largest Tech and coding Community and Fast Forward Your career with GreatToCode. •10000+ Learner's+ 90 % placement Guarantee. • Learning Coding is Better with the GreatToCode community .
•Greattocode Kid's •GreatToCode Career •GreatToCode Interview •GreatToCode Professional •GreatToCode for schools •GreatToCode For colleges •GreatToCods For Businesses.
Are you ready to join the millions of people learning to code? GreatToCode Pass is your one-stop-shop to get access to 1000+ courses, top-notch support, and successful job placement. What are you waiting for? Sign up now and get your future in motion with GreatToCode Pass.