-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathQ24.C
More file actions
55 lines (55 loc) · 1.04 KB
/
Q24.C
File metadata and controls
55 lines (55 loc) · 1.04 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
#include<stdio.h>
#include<conio.h>
#define size 2
struct student{
int roll_no;
char name[20];
int age;
int marks[3];
int total;
};
void main()
{
int i,c;
static struct student s[size];
clrscr();
for(i=0;i<size;i++)
{
printf("Enter Student %d details:\n",i+1);
printf("Enter roll number:\t");
scanf("%d",&s[i].roll_no);
printf("Enter name:\t");
scanf("\n");
gets(s[i].name);
printf("Enter age:\t");
scanf("%d",&s[i].age);
s[i].total=0;
printf("Enter marks:\n");
for(c=0;c<3;c++){
scanf("%d",&s[i].marks[c]);
s[i].total+=s[i].marks[c];}
for(c=0;c<32;c++)
printf("=");
printf("\n");
}
clrscr();
printf("\n\n\t\t\tStudent Record\n\n");
for(i=0;i<size;i++)
{
printf("Student %d details:\n\n",i+1);
printf("Roll number:\t");
printf("%d\n",s[i].roll_no);
printf("Name:\t");
puts(s[i].name);
printf("Age:\t");
printf("%d\n",s[i].age);
printf("Marks in:\n");
for(c=0;c<3;c++)
printf(" Sub%d:\t%d\n",c+1,s[i].marks[c]);
printf("Total:\t%d\n\n",s[i].total);
for(c=0;c<32;c++)
printf("=");
printf("\n\n");
}
getch();
}