construit structure data bate for student containing
3 members called roll number, name and marks.
Develop a program that would assign values to the
individual members in a class of 50 students and
display the details along with the total and average
mark of the class,
Answers
Answered by
0
#include <stdio.h>
struct student {
char name[50];
int roll;
float marks;
} s;
int main() {
printf("Enter information:\n");
printf("Enter name: ");
fgets(s.name, sizeof(s.name), stdin);
printf("Enter roll number: ");
scanf("%d", &s.roll);
printf("Enter marks: ");
scanf("%f", &s.marks);
printf("Displaying Information:\n");
printf("Name: ");
printf("%s", s.name);
printf("Roll number: %d\n", s.roll);
printf("Marks: %.1f\n", s.marks);
return 0;
}
Similar questions
English,
4 months ago
Art,
4 months ago
Math,
9 months ago
Social Sciences,
9 months ago
Physics,
1 year ago