File tree 1 file changed +55
-0
lines changed
1 file changed +55
-0
lines changed Original file line number Diff line number Diff line change
1
+ #include < iostream>
2
+ using namespace std ;
3
+
4
+ struct student
5
+ {
6
+ char name[50 ];
7
+ int roll;
8
+ float marks1;
9
+ float marks2;
10
+ float marks3;
11
+ } s[5 ];
12
+
13
+ int main ()
14
+ {
15
+ int x;
16
+ cout << " Enter information of students: " << endl;
17
+
18
+ // storing information
19
+ for (int i = 0 ; i < 5 ; ++i)
20
+ {
21
+
22
+ cout << " For roll number" <<endl;
23
+ cin>>s[i].roll ;
24
+
25
+ cout << " Enter name: " ;
26
+ cin >> s[i].name ;
27
+
28
+ cout << " Enter marks1: " ;
29
+ cin >> s[i].marks1 ;
30
+ cout << " Enter marks2: " ;
31
+ cin >> s[i].marks2 ;
32
+ cout << " Enter marks3: " ;
33
+ cin >> s[i].marks3 ;
34
+
35
+ cout << endl;
36
+ }
37
+
38
+ cout << " Displaying Information: " << endl;
39
+
40
+ // Displaying information
41
+ for (int i = 0 ; i < 5 ; ++i)
42
+ {
43
+ x=(s[i].marks1 +s[i].marks2 +s[i].marks3 );
44
+ cout << " \n Roll number: " << s[i].roll << endl;
45
+ cout << " Name: " << s[i].name << endl;
46
+ cout << " Marks1: " << s[i].marks1 << endl;
47
+ cout << " Marks2: " << s[i].marks2 << endl;
48
+ cout << " Marks3: " << s[i].marks3 << endl;
49
+ cout <<" total marks:" <<x<<endl;
50
+ cout<<" percentage:" <<x/3 <<endl;
51
+ }
52
+
53
+ return 0 ;
54
+ }
55
+
You can’t perform that action at this time.
0 commit comments