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
Political Science,
5 months ago
Math,
5 months ago
Math,
10 months ago
Social Sciences,
10 months ago
Physics,
1 year ago