+ 5
Seems working fine for me. Did you get the input? cin >> temp;
2nd Jan 2021, 5:11 PM
noteve
noteve - avatar
+ 4
What is data type for variable <temp>?
2nd Jan 2021, 4:52 PM
Ipang
+ 3
Sudhanshu Pandey LOL 😂 Careful with swears bro ...
2nd Jan 2021, 5:14 PM
Ipang
+ 3
Sudhanshu Pandey Lol😅 Wlcm
2nd Jan 2021, 5:14 PM
noteve
noteve - avatar
+ 3
If it says "not inclusive", use > rather than >=
2nd Jan 2021, 8:17 PM
Sonic
Sonic - avatar
+ 2
Use double instead, Floating point literals like 36.1 or 36.9 are `double` type (by default). And comparison of a `float` and a `double` usually doesn't come as expected.
2nd Jan 2021, 5:02 PM
Ipang
+ 2
#include <iostream> using namespace std; int main() { //your code goes here float temperature; cin >> temperature; if (temperature >= 36.1 && temperature <= 36.9) { cout << "OK" << endl; } else { cout << "Not OK" << endl; } }
21st Sep 2021, 2:49 AM
Malik Mehrab Rashid
Malik Mehrab Rashid - avatar
+ 1
float temperature; cin >> temperature; if (temperature >= 36.1 && temperature <= 36.9) cout << "OK" << endl; else cout << "Not OK" << endl;
12th Sep 2021, 1:16 AM
Notorious Wrath
0
#include <iostream> using namespace std; int main() { float temp; cin >> temp; //your code goes here if(temp >= 36.1 && temp <= 36.9){ cout << "OK" << endl; } else { cout << "Not OK" << endl; } }
15th Dec 2021, 1:37 PM
Andhika Dwi Maulana
0
If I use float type, the program gives "Not OK" for the limit values (36.1 and 36.9). However, if I change the data type to double, it gives "ok" as expected. Why is that?
5th Jul 2022, 5:11 PM
Gpont
0
This Is Coorct Answer #include <iostream> using namespace std; int main() { //your code goes here float temperature; cin >> temperature; if (temperature >= 36.1 && temperature <= 36.9) { cout << "OK" << endl; } else { cout << "Not OK" << endl; } }
23rd Jan 2023, 7:16 AM
Budhabhushan Waghmare
Budhabhushan Waghmare - avatar