/ Published in: C
Celsius to Fahrenheit
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
/**************************************************** * c2f.c * * Computer Science 50 * Brendan Hart * * Converts Celsius into Fahrenheit * * Demostrates float data types, equations, math *****************************************************/ #include <cs50.h> #include <stdio.h> int main(void) { // ask temperature in Celsius // get temperature in Celsius float c = GetFloat(); // equation converts temperature in Celsius to Fahrenheit // declares variable f as temperature in Celsius float f = ((9.0 / 5.0)*c + 32.0); // prints results to .1 decimal appoximation return 0; }