Program to find Celsius to Fahrenheit and its reverse using if statement

In this post we will going to talk about program to find Celsius to Fahrenheit and its reverse using if statement and code for the program.

Code for program to find Celsius to Fahrenheit and its reverse using if statement

#include<stdio.h>
#include<conio.h>
int main()
{
int a;
float f, c, fa, Celsius;
printf("Enter the value:");
scanf("%d", &a);
 if(a==1)
{
 printf("Celsius to Fahrenheit conversion:\n");
printf("Enter Celsius:");
scanf("%f",&c);
fa=c*(9/5.0)+32;
printf("Fahrenheit is %f", fa);
 }
 else
 {
printf("Fahrenheit to Celsius conversion:\n");
printf("Enter Fahrenheit:");
scanf("%f", &f);
Celsius =(f-32)*(5/9.0);
printf("Celsius is %f", Celsius);
 }
return 0;
}

Output

Enter the value:5
Fahrenheit to Celsius conversion:
Enter Fahrenheit:64
Celsius is 17.777779
Enter the value:1
Celsius to Fahrenheit conversion:
Enter Celsius:25
Fahrenheit is 77.000000

Read: Program to display marks cadre


If You Like This Page Then Make Sure To Follow Us on Facebook, G News and Subscribe Our YouTube Channel. We will provide you updates daily.
Shares
facebook sharing button Share
twitter sharing button Tweet
whatsapp sharing button Share
telegram sharing button Share
pinterest sharing button Pin

Leave a Comment