CS 2073 Section 2, Spring 2009
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 teaching assistant the C program file (the file you made with the editor,
not the binary executable) with the command:
mail -s "CS2073 Assignment 2" ytian@cs.utsa.edu < f2c.c
This assignment is due at midnight on Tuesday, February 10, 2009