-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path48.c
More file actions
36 lines (27 loc) · 744 Bytes
/
48.c
File metadata and controls
36 lines (27 loc) · 744 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
// Program to maintain a record of any student and display the marksheet.
#include <stdio.h>
struct student {
int roll;
char name[50];
int m1, m2, m3;
};
int main() {
struct student s;
int total;
float per;
printf("Enter roll number: ");
scanf("%d", &s.roll);
printf("Enter name: ");
scanf("%s", s.name);
printf("Enter marks of 3 subjects: ");
scanf("%d %d %d", &s.m1, &s.m2, &s.m3);
total = s.m1 + s.m2 + s.m3;
per = total / 3.0;
printf("\n--- Marksheet ---\n");
printf("Roll No: %d\n", s.roll);
printf("Name: %s\n", s.name);
printf("Marks: %d %d %d\n", s.m1, s.m2, s.m3);
printf("Total: %d\n", total);
printf("Percentage: %.2f\n", per);
return 0;
}