when i divide two numbers inside an if statement and check for a condition, if goes false even if it should be true
if a directly type (w/h) inside if instead of s it gives wrong output.
given this input
5
10 1
165 100
180 100
170 100
160 100
it should give 3, but if i give (w/h) inside if instead of s it gives output as 1 I dont get it, if becomes false even though statement is true.
#include<iostream>
using namespace std;
int main()
{
long long n,c=0;
cin>>n;
while(n--)
{
long double w,h;
cin>>w>>h;
double s = w/h;
if(s >=1.6 && s <=1.7) // if((w/h)>=1.6 &&(w/h)<=1.7) becomes false for w=170, h=100
{
c++;
}
}
cout<<c;
}