/*uses logical OR to handle lowercase*/
#include <stdio.h>
int main(void)
  {
  double fahr, cels;
  int scale;			/*'C' for Celsius input, 'F' for Fahrenheit*/
/*get input type*/
  printf("Type C to convert Celsius to Fahrenheit, or F to go the other way: ");
  scale = getchar();
/*get input, and do the appropriate calculation*/
  printf("degrees? ");
  if((scale == 'C') || (scale == 'c'))
    {
    scanf("%lf", &cels);
    fahr = 9.0*cels/5.0+32.0;
    }
  else
    {
    scanf("%lf", &fahr);
    cels = 5.0*(fahr-32.0)/9.0;
    }
  printf("%.3f degrees Fahrenheit is %.3f degrees Celsius\n", fahr, cels);
  return 0;
  }

Next slide