Friday 11 March 2022

C Program To Convert Temperature Using a Function

 CONVERT TEMPERATURE

Code :

#include<stdio.h>

float convert_tempr(float cels);

int main()
{
    float celsius, fahrenheit;
   
    printf("\t   CONVERT TEMPERATURE\n");   
    printf("-------------------------------------------\n");

    printf("Enter temperature in Celsius : ");
    scanf("%f", &celsius);
   
    fahrenheit = convert_tempr(celsius);
   
    printf("\nEquivalent Fahrenheit temperature = %.2fF\n\n", fahrenheit);
    printf("*******************************************\n");
    return 0;
}

float convert_tempr(float cels)
{
    float fahr;
    fahr = (cels * 9/5) + 32;
   
    return fahr;
}


Come again Learn again !

« iCodeBuzz »


No comments:

Post a Comment