Skip to content

Instantly share code, notes, and snippets.

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