+ 1
Whts wrong in this code for conversion of farenheit temp into celsius temp
#include <iostream> using namespace std; int main() { int c=0,f=0; c=(f-32) *5/9; cout<<"enter temp. in f"<<endl; cin>>f; cout<<"temp in celsius is"<<c<<endl; return 0; }
1 ответ
+ 1
the line in which value of c is calculated must be placed after the input of f.
also use float instead of int.
corrected code:
#include <iostream>
using namespace std;
int main()
{
float c=0,f=0;
cout<<"enter temp. in f"<<endl;
cin>>f;
c=(f-32) *5/9;
cout<<"temp in celsius is"<<c<<endl;
return 0;
}