Friday, 5 January 2018

Centigrade to Fahrenheit and vice-versa

C Program to convert Centigrade to Fahrenheit and vice-versa

#include<stdio.h>
void main()
{
    float cent,fahr;
    
    printf("Enter temperature in centigrade: ");
    
    scanf("%f",&cent);
    
    fahr = 9.0/5.0 * cent + 32.0;
    
    printf("Fahrenheit equivalent is %.1f\n",fahr);
    
    printf("\nEnter temperature in fahrenheit: ");
    
    scanf("%f",&fahr);
   
    cent = 5.0/9.0 * (fahr-32.0);
   
    printf("Centigrade equivalent is %.1f\n",cent);
   
    return 0;

}



No comments:

Post a Comment

Featured Post

TCS Latest Test Patern ( For On-Campus Drives )

Tata Consultancy Services is software services consulting company whose  headquarter is situated in Mumbai, India. It is the Asia’s larges...