I'd like to apologize ahead of time if this is a dumb question, since I'm just a bit of a beginner with C. This exercise tells you to create a program that prints a conversion chart of Fahrenheit - Celsius (Though I'm doing it the other way around) with the use of a function. I looked up the solution (http://www.eng.uerj.br/~fariasol/disciplinas/LABPROG/C_language/Kernighan_and_Ritchie/solved-exercises/solved-exercises.html/krx115.html), and was wondering whether or not I could do the same in a different way/without explicitly stating "upper", "lower", and "step". This is what I came up with:
#include <stdio.h>
int conv(int cel, int fahr);
main() {
int c, f;
f = 0;
for (c = 0; c <= 100; c = c + 5) {
printf("%d\t%d\n", c, conv(c, f));
}
}
int conv(int cel, int fahr)
{
fahr = (fahr-32) * (5/9);
return fahr;
}
However, this just prints a column of 0 to 100 and a column of all 0's. What am I doing wrong?