C Programs to practice -Fahrenheit to Celsius and Celsius to Fahrenheit conversions

 Fahrenheit to Celsius conversion:

This is a simple temperature conversion program. In this program ,the given temperature is in Fahrenheit. This program converts it to Celsius by using a simple formula.

Program: “Fahrentocelsius.c”

#include<stdio.h>

#include<conio.h>

void main()

{

/* variable declaration statement. Fa- Fahrenheit, ce- Celsius */

 float fa, ce;                     

printf(“ Enter the temperature value in Fahrenheit”);

/* read the Fahrenheit value */

scanf(“%f”,&fa);     

/ * formula for converting Fahrenheit to Celsius value */

ce=(fa-32)*5/9;

/* The converted celsius  value*/

printf(“The temperature value in celsius is: %f”,ce);

getch();

}


Try it :

In the same way, you can try the Celsius to Fahrenheit conversion in  your own.

Steps for converting Celsius to Fahrenheit:

Declare two variable Celsius,Fahrenheit as float.

Get the input for Celsius temperature value.

Use the formula to convert Celsius to Fahrenheit.

Print the Fahrenheit value.

#include<stdio.h>

#include<conio.h>

void main()

{

 float fahren,Celsius;

printf(“ enter the Celsius valus”);

scanf(“%f,&Celsius);

fahren=(Celsius*1.8)+32;

printf(“The converted  value  is:%f”,fahren);

getch();

} 

How to install turbo c++ in your pc/Laptop?

C is a structured programming language. It was developed by Dennis Ritchie in AT&T bell laboratories. It is the base language of all programming language. Bcpl and B languages are the previous languages.

Features:

C has lot of features.

·       C is a middle level language. It supports system level functions and high level programming.

·       It is portable. The user can run in any machine. It is machine independent language.

·       It is a Structured programming language. It supports functions.

·       The compilation and execution speed is fast because it has many inbuilt functions.

·       It is extensible language.

 How to Install turbo C++?

     C programming starts from installing turbo c++ compiler in your system. It has the following steps:

  •  First, Download the turbo c++ software from website. It downloads a zip file “tc3.zip”
  •  Create a folder “turboc” in c: \ and Extract the “tc3.zip” to this folder.
  •  Check the folder c:\turboc and click install.exe file
  •  Install it and start using the turbo c++.

 Thats all. Your Laptop/Pc is loaded with turbo c++.


How to create files, compile and run  in turbo c++ environment?

  •     In the file menu,select new file option.
  •     A New file will be opened. Save it with proper name with .c extension.
  •     Now, start writing your c code to this file.
  •     Once you finished the coding, press alt+f9 key to compile the program.
  •     It shows the error report. If there are any errors, check the code and correct it. Compile it again until there are no errors.
  •     To run the program, press ctrl+f9 key. It shows the output window. There, enter the input values. If your program is correct, it shows the correct output.

This is the first step for C Programming.Let's start the journey of C programming.