Conversion(Fahrenheit to celsius)

which case is wrong for my code
#include
using namespace std;
int main(){
int min,max,step,far,c;
cin>>min>>max>>step;
if(((0<min)&&(min<100))&&((min<max)&&(max<500))&&(step>0))
{
for(far=min;far<=max;far+=step)
{
cout<<far;
c=5*(far-32)/9;
cout<<" "<<c<<endl;
}
}
else cout<<“invalid”;

return 0;

}

your mistakes :

  1. don’t print “invalid” bcz it is not specified in output format
  2. no need to check constraints while writing program bcz constraints are only made for users and constraints are used for taking correct variable input.
    ex: if constraint is :

0<n<10^10

then take variable input n as

long long int n; // only int not work bcz of constraint

this is how constraints are check no need to use If-else statement to check it.

Modified Code :

i hope this help, if you have further doubt feel free to ask

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.