India Languages, asked by vikky9958, 9 months ago

Create a C program that would read the academic record of 5 students. After the record of all the students have been entered, the user should be provided with a menu which has the following:❑Enter ‘1’ to display the names of all the students❑Enter ‘2’ to find the average mark of all the students in Maths❑Enter ‘3’ to search for a particular student based on the roll number Each record should contain the following:❑Name of the student❑Roll no❑Mark in Maths❑Mark in Sanskrit❑Mark in Programming The code to display the name of all the students, finding the average and to search should be within three separate functions (one function to display the name of all students, one function for finding the average, likewise one function to search for a student based on a roll number)

Answers

Answered by aadhyajha329
1

Answer:

struct student {

   char firstName[50];

   int roll;

   float marks;

} s[10];

int main() {

   int i;

   printf("Enter information of students:\n");

   // storing information

   for (i = 0; i < 5; ++i) {

       s[i].roll = i + 1;

       printf("\nFor roll number%d,\n", s[i].roll);

       printf("Enter first name: ");

       scanf("%s", s[i].firstName);

       printf("Enter marks: ");

       scanf("%f", &s[i].marks);

   }

   printf("Displaying Information:\n\n");

   // displaying information

   for (i = 0; i < 5; ++i) {

       printf("\nRoll number: %d\n", i + 1);

       printf("First name: ");

       puts(s[i].firstName);

       printf("Marks: %.1f", s[i].marks);

       printf("\n");

   }

   return 0;

}

Explanation:

Hope t helps

Similar questions