Sunday, February 1, 2015
Temperature conversion function in C
#include<stdio.h>
double cf(double fahrenheit)
{
return (5.0/9.0) * (fahrenheit-32);
}
double main()
{
double celsius;
double fahrenheit;
printf("Enter the temperature in degrees fahrenheit:\n");
scanf("%lf", &fahrenheit);
celsius = cf(fahrenheit);
printf ("result %lf\n", celsius);
return 0;
}
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment