-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathques1.cpp
More file actions
80 lines (78 loc) · 1.49 KB
/
ques1.cpp
File metadata and controls
80 lines (78 loc) · 1.49 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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#include <iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main()
{
int n;
int Max=0;
int frist=0,last=39;
int max_marks;
vector<float>obj;
vector<int>ob(7,0);
cin >> n;
cin >> max_marks;
for(int i=0;i<n;i++)
{
float n1;
cin >> n1;
if(n1>Max)
{
Max = n1;
}
float m=((n1)/max_marks)*100.0;
obj.push_back(m);
}
for(int i=0;i<obj.size();i++)
{
if(obj[i]>=0 && obj[i]<=39)
{
ob[0]++;
}
else if(obj[i]>=40 && obj[i]<=49)
{
ob[1]++;
}
else if(obj[i]>=50 && obj[i]<=59)
{
ob[2]++;
}
else if(obj[i]>=60 && obj[i]<=69)
{
ob[3]++;
}
else if(obj[i]>=70 && obj[i]<=79)
{
ob[4]++;
}
else if(obj[i]>=80 && obj[i]<=89)
{
ob[5]++;
}
else if(obj[i]>=90 && obj[i]<=100)
{
ob[6]++;
}
}
for(int i=0;i<7;i++)
{
if(i==0)
{
cout << frist << "-" << last << " " << ob[i] <<endl;
frist = last + 1;
last = last + 10;
}
else
{
cout << frist << "-" << last << " " << ob[i] <<endl;
frist = last + 1;
last = last + 10;
if((i==5))
{
++last;
}
}
}
cout << Max;
return 0;
}