Due Monday, October 18 by the beginning of class
All answers (files) should be stored in a folder named H:\Homework\HW1
H:\Homework\HW1\id.txt
Edit the file to add your name, computer account name (cs5a??), and preferred e-mail address. The e-mail address can be your cs5a computer account (cs5a??@ieng9.ucsd.edu) or it could be your own e-mail address. This will be the address we will send homework scores to.
/*
* FtoC1 – print a Fahrenheit-to-Celsius
* conversion table
*/
#include <stdio.h>
int main (void)
{
int fahr;
int celsius;
int lower = 10;
int upper = 300;
int step = 27;
fahr = lower;
while (fahr <= upper) {
celsius = 5 * (fahr - 32) / 9;
printf ("%d\t%d\n", fahr, celsius);
fahr = fahr + step;
}
return 0;
}
Once you have this program working, modify the line
celsius = 5 * (fahr - 32) / 9;so that it reads:
celsius = (5/9) * (fahr - 32);
and run the program now. What does the output look like this time? Write a sentence or two in ftoc.txt that describes the output.
For extra credit, try changing the program so that a heading gets printed above the table. It could look something like this:
F C
--- --- ... and then the temperature table.