-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPS1SMAR1.C
More file actions
55 lines (44 loc) · 1.18 KB
/
PS1SMAR1.C
File metadata and controls
55 lines (44 loc) · 1.18 KB
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
//TITLE : WAP to CREATE STUDENT MARKSHEET USING ARRAY OF STRUCTURE
#include <stdio.h>
#include <conio.h>
struct amroli
{
int rno;
char sname[20];
int m1,m2,m3,m4,m5,tot;
float per;
} stud[10];
void main()
{
int i;
clrscr();
printf("ENTER DATA FOR STUDENT:\n ");
for(i =0;i<5;i++)
{
printf("ENTER student details for [%d]:\n",i);
printf("Name: ");
scanf("%s",stud[i].sname);
printf("\nPlease Enter Marks for Sub1: ");
scanf("%d",&stud[i].m1);
printf("Please Enter Marks for Sub2: ");
scanf("%d",&stud[i].m2);
printf("Please Enter Marks for Sub3: ");
scanf("%d",&stud[i].m3);
printf("Please Enter Marks for Sub4: ");
scanf("%d",&stud[i].m4);
printf("Please Enter Marks for Sub5: ");
scanf("%d",&stud[i].m5);
stud[i].tot = stud[i].m1 + stud[i].m2 + stud[i].m3 + stud[i].m4 + stud[i].m5;
stud[i].per = stud[i].tot / 5;
}
for (i=0;i<5;i++)
{
printf("Student details for : %d :\n",i);
printf("Name: %s \n",stud[i].sname);
printf("Marks Sub1 Sub2 Sub3 Sub4 Sub5: \n");
printf("\t%4d %4d %4d %4d %4d :\t",stud[i].m1,stud[i].m2,stud[i].m3,stud[i].m4,stud[i].m5);
printf("Total:%d\t",stud[i].tot);
printf("Percentage:%lf\n",stud[i].per);
}
getch();
}