Here, we have a basic program example to convert centigrade to fahrenheit using different languages. This program is created in c language, c++, Java, and Python.
Program to convert centigrade to Fahrenheit in C language
#include <stdio.h>
int main()
{
float celsius, fahrenheit;
printf("Enter temperature in Celsius: ");
scanf("%f", &celsius);
fahrenheit = (celsius * 9 / 5) + 32;
printf("%.2f Celsius = %.2f Fahrenheit", celsius, fahrenheit);
return 0;
}
Program to convert centigrade to Fahrenheit in C++ language
#include <iostream>
using namespace std;
int main(){
float celsius;
cout << "Enter temperature in Celsius\n";
cin >> celsius;
float fahrenheit = (9 * celsius) / 5;
fahrenheit += 32;
cout << "Temperature in Fahrenheit: " << fahrenheit;
return 0;
}
Program to convert centigrade to Fahrenheit in Python language
celsius=int(input("Enter the temperature in celcius:"))
fahrenheit=(celsius*1.8)+32
print("Temperature in farenheit is:",fahrenheit)
Program to convert centigrade to Fahrenheit in Java language
import java.util.Scanner;
class temperature{
public static void main(String[] args)
{
float celsius, fahrenheit;
Scanner sc = new Scanner(System.in);
System.out.print("Enter the temperature in celsius: ");
celsius =sc.nextFloat();
fahrenheit = (celsius * 9 / 5) + 32;
System.out.print("Enter the temperature in fahrenheit is: " +fahrenheit);
}
}