Converting Fahrenheit-Celsius & Vice-Versa

clarence_cool03 0 Tallied Votes 220 Views Share

{-='Converting Fahrenheit-Celsius & Vice-Versa using Dev-C LaNGuaGe'=-}

#include <stdio.h>

int main(void)
{
//  Local Declarations
    float Celsius, Fahrenheit, Fahrenheit_1, Celsius_2;
   
//  Statements
    printf("Enter the temperature in Fahrenheit: ");
    scanf("%f", &Fahrenheit);
    printf("Fahrenheit temperature is: %5.1f F\n\a", Fahrenheit);
   
    Celsius = (100.0 / 180.0) * (Fahrenheit - 32);
   
    printf("Celsius temperature is: %8.1f C\n\n\a", Celsius);
   
    system("pause");
    system("cls");
   
    printf("Enter the temperature in Celsius: ");
    scanf("%f", &Celsius_2);
    printf("Celsius temperature is: %8.1f C\n\a", Celsius_2);
   
    Fahrenheit_1 = 32 + (Celsius_2 * (180.0 / 100.0));
   
    printf("Fahrenheit temperature is: %5.1f F\a", Fahrenheit_1);
   
    system("pause");
    return 0;
}// main
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.