-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProblem_Set_28.c
More file actions
43 lines (35 loc) · 956 Bytes
/
Problem_Set_28.c
File metadata and controls
43 lines (35 loc) · 956 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
37
38
39
40
41
42
43
// Write a program to store the data of 3 students.
#include <stdio.h>
#include <string.h>
// User defined data type
struct student
{
int roll;
float cgpa;
char name[100];
}; // terminator(;) must used
int main()
{
struct student s1;
s1.roll = 55;
strcpy(s1.name, "Sayanjit Jana");
s1.cgpa = 8.5;
printf("Student name = %s\n", s1.name);
printf("Student roll no = %d\n", s1.roll);
printf("Student cgpa = %.2f\n", s1.cgpa);
struct student s2;
s2.roll = 28;
strcpy(s2.name, "Rahit Maity");
s2.cgpa = 8.0;
printf("Student name = %s\n", s2.name);
printf("Student roll no = %d\n", s2.roll);
printf("Student cgpa = %.2f \n", s2.cgpa);
struct student s3;
s3.roll = 70;
strcpy(s3.name, "Abhimanuy Mondal");
s3.cgpa = 8.3;
printf("Student name = %s\n", s3.name);
printf("Student roll no = %d\n", s3.roll);
printf("Student cgpa= %.2f\n", s3.cgpa);
return 0;
}