-
Notifications
You must be signed in to change notification settings - Fork 0
/
Result Chart of Student Using Struct And User input.c
65 lines (46 loc) · 1.49 KB
/
Result Chart of Student Using Struct And User input.c
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#include <stdio.h>
#include<string.h>
struct Student
{
int rollno;
char name[50];
int chemistry;
int maths;
int physics;
};
int main()
{
int n;
printf("Enter The Numbber of Student: ");
scanf("%d",&n);
struct Student students[n];
int i;
for (i = 0; i < n; i++)
{
printf("Enter details for Student %d:\n", i + 1);
printf("Roll No: ");
scanf("%d", &students[i].rollno);
printf("Name: ");
scanf("%s", students[i].name);
printf("Chemistry Marks (out of 100): ");
scanf("%d", &students[i].chemistry);
printf("Mathematics Marks (out of 100): ");
scanf("%d", &students[i].maths);
printf("Physics Marks (out of 100): ");
scanf("%d", &students[i].physics);
printf("\n");
}
printf("Mark Sheets:\n");
for (i = 0; i < n; i++)
{
float total_marks = students[i].chemistry + students[i].maths + students[i].physics;
float percentage = (total_marks / 300) * 100;
printf("\nStudent %d - Roll No: %d\n", i + 1, students[i].rollno);
printf("Name: %s\n", students[i].name);
printf("Chemistry Marks: %d\n", students[i]. chemistry);
printf("Mathematics Marks: %d\n", students[i].maths);
printf("Physics Marks: %d\n", students[i]. physics);
printf("Percentage: %.2f%%\n", percentage);
}
return 0;
}