-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlab1.cpp
More file actions
31 lines (27 loc) · 733 Bytes
/
Copy pathlab1.cpp
File metadata and controls
31 lines (27 loc) · 733 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
//write a program to take 5 numbers from user count and display number of passed and fail student
#include <iostream>
using namespace std;
int main()
{
cout << "enter 5 student marks: " << endl;
int a, pass = 0, fail = 0, sump = 0, sumf = 0;
for (int i = 0;i < 5;i++)
{
cin >> a;
if (a > 50) {
pass++;
sump = (a + sump);
}
else
fail++;
sumf = a + sumf;
}
int pased = 0;
int faied = 0;
cout << "pass student" << pass << endl;
pased = (sump / pass);
cout << "avarage of pass" << pased << endl;
cout << "fail student" << fail << endl;
faied = (sumf / fail);
cout << "avarage of pass" << faied << endl;
}