Pages

Saturday, November 12, 2011

Program to convert Farenhite temperature into Celcius temperature and vice-versa (Ref:Let us c-chapter1)

This program convert entered Farenhite temperature into centigrade temperature or vice-versa.


Temperature of a city in Farenhite degrees is input through the keyboard.Write a program to convert this temperature into centigrade degrees.


Note:To convert Fahrenheit to Celsius, subtract 32 degrees  and divide by 1.8.
while for converting Celsius to Fahrenheit, multiply by 1.8 and add 32 degrees


#include<stdio.h>


void main()


{


float temp_f,temp_c;


clrscr();


printf("Enter the value of temperature in Celcius:");


scanf("%f",&temp_c);


temp_f=(1.8*temp_c)+32;


printf("The value of temperature in Fahrenheit is :%f",temp_f);


getch();


}

No comments: