Saturday 15 October 2011

(d) Temperature of a city in Fahrenheit degrees is input through the keyboard. Write a program to convert this temperature into Centigrade degrees.



/* This program takes temperature in Fahrenhites as input from user converts it into
degree celsius and then shows results .*/
#include<stdio.h>
#include<conio.h>
int main()
{
    /*Declaring and initializing variables*/
    float celcius = 0;
    float fahrenhite =0;
   
    /*prompt for input*/
    printf("\nPlease enter the temperature in Degree Fahrenhites: ");
  
    /*Taking temperature in fahrenhite as input from user*/
    scanf("%f",&fahrenhite);
   
    /*Calculations*/
    celcius = (5.0*(fahrenhite-32))/9.0;
   
    /*showing results*/
    printf("\nTemperature is %f degree celcius",celcius);
    getche();
    return 0;
}
   
   


1 comment: