Last active
November 14, 2015 16:29
-
-
Save gregmacfarlane/40f30bb653dbaa6fc086 to your computer and use it in GitHub Desktop.
Temperature converter in C
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import<stdio.h> | |
double convert_temp(double temp_f){ | |
double temp_c; | |
temp_c = (temp_f - 32) * 5/9; | |
return(temp_c); | |
} | |
int main(){ | |
double temp_f; | |
double temp_c; | |
printf("Enter the temperature in degrees farenheit:"); | |
scanf("%lf", &temp_f); | |
temp_c = convert_temp(temp_f); | |
printf("The temperature in celsius is %f degrees.\n", temp_c); | |
if(temp_f > 80){ | |
printf("It's pretty hot, you should bring water.\n"); | |
} | |
return(0); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment