Professional Documents
Culture Documents
Question No 20
Question No 20
Write a C program using structure to accept the marks of 3 subjects of 'n' students at a
time and find the marks
Sure, here's a C program that uses a structure to accept the marks of 3 subjects for 'n'
students at a time and finds the total marks:
c Copy code
#include <stdio.h>
struct student {
int subject1;
int subject2;
int subject3;
int total;
};
int main() {
int n, i;
printf("Enter the number of students: ");
scanf("%d", &n);
printf("\n\nStudent\t\tTotal Marks\n");
for (i = 0; i < n; i++) {
printf("Student %d\t%d\n", i + 1, students[i].total);
}
return 0;
ChatGPT }
Feb 13 Version. Free Research Preview. Our goal is to make AI systems more natural and safe to interact with. Your
feedback will help us improve.