Saturday, March 6, 2021

C program to get temperature in fahrenheit from the user and then print the temperature in celcius.

 

1.     Write a C program to get temperature in fahrenheit from the user and then print the temperature in celcius.

 

#include <stdio.h>

#include<conio.h>

int main()

{

    float c, f;

    printf("Enter temperature in Fahrenheit: ");

    scanf("%f", &f);

    c = (f - 32) * 5 / 9;

    printf("%.2f Fahrenheit = %.2f Celsius", f, c);

    return 0;

}

1 comment: