CS 2073 Section 2, Spring 2007
Assignment 2: Simple Computations with User Input
For this assignment, you will:
- Make a subdirectory called assign2 in your account.
Do your work for this assignment in this directory. To make
the directory, use the following command on the main computers:
mkdir assign2
To change to that directory so that you may work in it, instead of
the current (home) directory, do:
cd assign2
When you want to return to your home directory, simply type cd
with no parameters.
- Write a C program called f2c.c that
- Prompts the user with "Enter degrees Fahrenheit:"
- Reads a floating point number using scanf
- Converts the number from degrees Fahrenheit to Celcius and Kelvin
- Prints the original number, then
" degrees Fahrenheit is ", then
the Celcius temperature, then " Celcius and ", then
the Kelvin temperature, then " Kelvins."
For instance, if the user enters 212, your program should print:
212.0 degrees Fahrenheit is 100.0 Celcius and 373.0 Kelvins
Make sure to put
descriptive comments and your name in your program; see the program in
Assignment 1 for a model of how to use comments.
- Run the program on several test cases until you are confident the
program works.
- Send the instructor the C program file (the file you made with the editor,
not the binary executable) with the command:
mail -s "CS2073 Assignment 2" dj@cs.utsa.edu < f2c.c
This assignment is due at midnight on Tuesday, February 13, 2007
Hint: Read Chapter 2 in your book. There are several hints there
for how you would do this kind of assignment.