Skip to content

Instantly share code, notes, and snippets.

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