Using Structures in C, write an interactive program to display the mark-sheet and grade card for 10 students for a MOOC course. Note: Assumptions can be made wherever necessary and mention them

, ,

Certainly! Below is an interactive C program that uses structures to display the mark-sheet and grade card for 10 students in a MOOC (Massive Open Online Course) course. The program assumes that each student has three subjects, and the grades are calculated based on the total marks obtained.

```c

#include <stdio.h>

// Structure to represent a student

struct Student {

char name[50];

int marks[3]; // Assuming 3 subjects

float totalMarks;

char grade;

};

// Function to calculate total marks and grade for a student

void calculateGrade(struct Student *student) {

student->totalMarks = student->marks[0] + student->marks[1] + student->marks[2];

if (student->totalMarks >= 240) {

student->grade = 'A';

} else if (student->totalMarks >= 180) {

student->grade = 'B';

} else if (student->totalMarks >= 120) {

student->grade = 'C';

} else {

student->grade = 'F';

}

}

// Function to display mark-sheet and grade card for a student

void displayStudentInfo(struct Student student) {

printf("Name: %s\n", student.name);

printf("Marks: Subject 1 - %d, Subject 2 - %d, Subject 3 - %d\n", student.marks[0], student.marks[1], student.marks[2]);

printf("Total Marks: %.2f\n", student.totalMarks);

printf("Grade: %c\n", student.grade);

printf("\n");

}

int main() {

// Assuming 10 students

struct Student students[10];

// Input details for each student

for (int i = 0; i < 10; i++) {

printf("Enter details for Student %d:\n", i + 1);

printf("Name: ");

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

printf("Enter marks for Subject 1: ");

scanf("%d", &students[i].marks[0]);

printf("Enter marks for Subject 2: ");

scanf("%d", &students[i].marks[1]);

printf("Enter marks for Subject 3: ");

scanf("%d", &students[i].marks[2]);

// Calculate total marks and grade for each student

calculateGrade(&students[i]);

}

// Display mark-sheet and grade card for each student

for (int i = 0; i < 10; i++) {

printf("Mark-Sheet and Grade Card for Student %d:\n", i + 1);

displayStudentInfo(students[i]);

}

return 0;

}

```

This program prompts the user to enter details for 10 students, including their names and marks for three subjects. The program then calculates the total marks and assigns a grade to each student based on the total marks. Finally, it displays the mark-sheet and grade card for each student. Note that the assumption here is that the total marks for each subject are out of 100, and the grade criteria are arbitrary for demonstration purposes. You can modify the grade calculation logic based on the specific criteria you want to apply.