Please what is wrong with my code... It is printing Out Ok when the temperature is greater than 36.9 | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Please what is wrong with my code... It is printing Out Ok when the temperature is greater than 36.9

#include <iostream> using namespace std; int main() { //your code goes here float temperature; cin>>temperature; if(36.1<= temperature <=36.9){ cout<<"OK"<<endl; } else{ cout<<"Not OK"<<endl; } }

12th Jun 2022, 8:17 AM
Priscilla💋💋
Priscilla💋💋 - avatar
1 Answer
+ 3
condition is wrong Use && to compare Examples: a && b a < 0 && b > 0 a > 0 && b < 0
12th Jun 2022, 8:23 AM
A͢J
A͢J - avatar