Blogger templates

Pages

Wednesday, 2 May 2012

C Program: Conversion of Fahrenheit Temprature to Celsius Temprature

celsius and temprature

Function of void main() :
  • Main function of every C and C++ program. 
  • The execution of C program starts with the main() function. 
  • No program run without main() function.
  • There is no difference between void main() and main().
Statement of C program: Enter the Temprature in Fahrenheit and converts Fahrenheit into Celsius:
 
#include<stdio.h>
#include<conio.h>
void main()
{
float ft , ct;                                                               // ft stands for fahrenheit temprature.
                                                                                // ct stands for celsius temprature.
clrscr();
printf("Enter the temprature in fahrenheit/n");
scanf("%f" , &ft);
ct=(ft-32)/18;                                                                // Formula of Celsius
printf("Fahrenheit temprature = %f/n" , ft);
printf("Celsius temprature = %f/n" ,ct);
}

Output:
Enter the temprature in fahrenheit
64
Fahrenheit temprature = 64
Celsius temprature = 1.7777.... 



0 comments:

Post a Comment