Skip to content

Instantly share code, notes, and snippets.

@funrep
Created September 25, 2012 16:03
Show Gist options
  • Save funrep/3782793 to your computer and use it in GitHub Desktop.
Save funrep/3782793 to your computer and use it in GitHub Desktop.
hello
/*fahrenheight to celsius program*/
#include <stdio.h>
#define LOWER 0
#define UPPER 300
#define STEP 20
int celsius(float);
main()
{
float fahr;
printf("Fahrenheight Celsius\n");
for (fahr = LOWER; fahr < UPPER; fahr = fahr + STEP)
printf("%3.0f\t\t\t%6.1d\n", fahr, celsius(fahr));
return 0;
}
celsius(float f)
{
int c;
c = (5.0/9.0) * (f - 32.0);
return c;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment