-
Notifications
You must be signed in to change notification settings - Fork 2
/
BMI.cpp
42 lines (40 loc) · 940 Bytes
/
BMI.cpp
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
#include <iostream>
using namespace std;
int main()
{
int ile;
cin>>ile;
string osoby[ile];
double masa[ile], wzrost[ile];
double BMI[ile];
for(int i=0; i<ile; i++)
{
cin>> osoby[i]>> masa[i] >> wzrost[i];
BMI[i] = (masa[i]/(wzrost[i]*wzrost[i])*10000);
}
cout<<"niedowaga"<<'\n';
for(int i=0; i<ile; i++)
{
if(BMI[i] < 18.5)
{
cout<<osoby[i]<<'\n';
}
}
cout<<"\nwartosc prawidlowa"<<'\n';
for(int i=0; i<ile; i++)
{
if(BMI[i] >= 18.5 && BMI[i] < 25.0)
{
cout<<osoby[i]<<'\n';
}
}
cout<<"\nnadwaga"<<'\n';
for(int i=0; i<ile; i++)
{
if(BMI[i] >= 25.0)
{
cout<<osoby[i]<<'\n';
}
}
return 0;
}