C Program to convert Celsius to Fahrenheit
C Program to convert the temperature Celsius to Fahrenheit. It is easier to develop programs using IDE. In this tutorial, we will use Code::Blocks IDE.
https://www.testingdocs.com/download-and-install-codeblocks/
C Program
#include<stdio.h> int main() { float f,c; int choice; printf("--- Menu ---\n"); printf("1. Celsius to Fahrenheit.\n"); printf("2. Fahrenheit to Celsius.\n"); printf("Enter choice :"); scanf("%d",&choice); if(choice == 1) { printf("Enter the Temperature in Celsius :"); scanf("%f",&c); f=(c*9)/5+32; printf("Temperature in Fahrenheit is:%.2f",f); } else if(choice ==2) { printf("Enter the Temperature in Fahrenheit :"); scanf("%f",&f); c=(f- 32)*5/9; printf("Temperature in Celsius is:%.2f",c); } else { printf("INVALID option."); } return 0; }
Output
Menu —
1. Celsius to Fahrenheit.
2. Fahrenheit to Celsius.
Enter choice :2
Enter the Temperature in Fahrenheit :98.4
Temperature in Celsius is:36.89
Debugging
https://www.testingdocs.com/debugging-a-c-program-in-codeblocks/