summaryrefslogtreecommitdiffstats
path: root/1/15.c
blob: 3499ec7e060365926b6b5f3b3155f1a00694366e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#include <stdio.h>

/* converts fahrenhite to celsius */
int ftoc(int fahr);

int main(int argc, char *argv[]) {
  int fahr, celsius;
  int lower, upper, step;

  lower = 0;
  upper = 300;
  step = 20;
  fahr = lower;

  while (fahr <= upper) {
    printf("%d\t%d\n", fahr, ftoc(fahr));
    fahr += step;
  }

  return 0;
}

int ftoc(int fahr) { return 5 * (fahr - 32) / 9; }