Problem statement:- Program to Convert Temperature from degree Celsius to Fahrenheit.
Data requirement:-
Input Data:-celsius
Output Data:-fahrenheit
Output Data:-fahrenheit
Program in C
Here is the source code of the C Program to Convert Temperature from degrees Celsius to Fahrenheit.
Code:
Code:
#include<stdio.h>
int main(){
double fahrenheit,celsius;
printf("Enter degree in Celsius:");
scanf("%lf",&celsius);
fahrenheit=(celsius*(9/5))+32;
printf("Degree in Fahrenheit is %0.2lf",fahrenheit);
}
Input/Output:
Enter degree in Celsius:49.55
Degree in Fahrenheit is 81.55
Degree in Fahrenheit is 81.55
Program in C++
Here is the source code of the C++ Program to Convert Temperature from degrees Celsius to Fahrenheit.
Code:
Code:
#include<iostream>
using namespace std;int main()
{
double fahrenheit,celsius;
cout<<"Enter degree in celsius:";
cin>>celsius;
fahrenheit=(celsius*(9/5))+32;
cout<<"Degree in Fahrenheit is "<<fahrenheit;
}
Input/Output:
Enter degree in celsius:57.5
Degree in Fahrenheit is 89.5
Degree in Fahrenheit is 89.5
Program in Java
Here is the source code of the Java Program to Convert Temperature from degrees Celsius to Fahrenheit.
Code:
Code:
import java.util.Scanner;
public class CelsiusToFahrenheit {public static void main(String[] args) {
Scanner cs=new Scanner(System.in);
double fahrenheit,celsius;
System.out.println("Enter degree in Celsius:");
celsius=cs.nextDouble();
fahrenheit=(celsius*(9/5))+32;
System.out.println("Degree in Fahrenheit is "+fahrenheit);
cs.close();
}
}
Input/Output:
Enter degree in Celsius:
33
Degree in Fahrenheit is 65.0
33
Degree in Fahrenheit is 65.0
Program in Python
Here is the source code of the Python Program to Convert Temperature from degrees Celsius to Fahrenheit.
Code:
Code:
celsius=float(input("Enter degree in celsius: "))
fahrenheit=(celsius*(9/5))+32
print("Degree in Fahrenheit is",fahrenheit)
fahrenheit=(celsius*(9/5))+32
print("Degree in Fahrenheit is",fahrenheit)
Input/Output:
Enter degree in celsius: 47.5
Degree in Fahrenheit is 117.5
Most Recommend Questions:-
More Questions:-
0 Comments
Please do not Enter any spam link in the comment box