please tell errors in my code
Conversion (Fahrenheit to Celsius)
Hello, @Mayankrocks,
You are printing like this:
cout<<i<<c<<endl;
Instead, print like this:
cout<<i << " " <<c<<endl;
code is showing test cases failed
Change your while loop likes this,
while(i<=f2){
c=5*(i-32);
c = c/9;
cout<<i<<" "<<c<<endl;
i=i+step;
}
Earlier your c was always zero,
=> c = (5/9)(i-32)
=> c = (0.5)(i-32)
=> c = 0*(i-32)
=> c = 0
again test cases failed
in code section of problem
Could you please share your code here.
#include
using namespace std;
int main() {
int f1;
int f2;
int step;
cin>>f1;
cin>>f2;
cin>>step;
int c;
int i=f1;
while(i<=f2)
{
c=5*(i-32);
c = c/9;
cout<<i<<" "<<c<<endl;
i=i+step;
}
return 0;
}
please tell something
it passed all test cases now
it was in collaborate mode so can’t run
please send the feedback
yes
sir
feedback send kardo
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.