Chapter 4:
Input And Output
Programming Exercise
Problem # 11:
Write a program that inputs temperature from the user in Farenheit and converts it into Celsius degree using formula C = 5/9(F-32).
Solution:
#include<iostream>
#include<conio.h>
using namespace std;
int main()
{
float F, C;
cout<<"Enter temperature in Farenheit : ";
cin>>F;
C = (5.0/9.0) * (F - 32);
cout<<"Temperature in Celsius : "<<C<<endl;
return 0;
}
#include<conio.h>
using namespace std;
int main()
{
float F, C;
cout<<"Enter temperature in Farenheit : ";
cin>>F;
C = (5.0/9.0) * (F - 32);
cout<<"Temperature in Celsius : "<<C<<endl;
return 0;
}
Code Screenshot:
Output:
Let me know in the comment section if you have any question.
Previous Post:
10. Program that inputs total number of student in a class and fee per student. It displays total fee collected from the class.
This comment has been removed by a blog administrator.
ReplyDelete