Conversion (Fahrenheit to Celsius)

please tell errors in my code

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

@Mayankrocks,

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

@Mayankrocks,

where are you submitting?
I can’t see your submissions

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

@Mayankrocks,

Okay let me see

it passed all test cases now

it was in collaborate mode so can’t run

please send the feedback

@Mayankrocks,

Is your doubt resolved now?

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.