#include<bits/stdc++.h>
using namespace std;
int ftoc(int);
int main() {
int min;
int max;
int step;
cin>>min>>max>>step;
for(int i=min;i<=max;)
{
int r=ftoc(min);
cout<<i<<" "<<r<<endl;
i+=step;
}
return 0;
}
int ftoc(int f){
int c=(5/9)*(f-32);
return c;
}
DOUBT - it is always returning 0
Hey @shyama
Try using 5.0/9.0 instead of 5/9
Because 5/9 will result in 0 since numerator is of int type
Let me know if this helps
hello sir , not working
#include<bits/stdc++.h> using namespace std; int ftoc(int); int main() { int min; int max; int step; cin>>min>>max>>step; for(int i=min;i<=max;) { int r=ftoc(i); cout<<i<<" "<<r<<endl; i+=step; } return 0; } int ftoc(int f){ int c=(5.0/9.0)*(f-32); return c; }
What issue are u facing now
Resolved , thankyou sir
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.