Lecture 3:  Variables, Values, and Types

Activity:  Programming Activity



We just saw a program to calculate a Celsius temperature given a Fahrenheit temperature.  Your friend from England tells you that it is 30 degrees Celsius in her hometown today.  Your friend tells you the temperature on a weekly basis, so you want to write a C program to do the conversion from Celsius to Fahrenheit.  Before writing the code, remember the important parts of the programming process:  Problem Description, The Algorithm, Writing the Code, and Testing the Code.  Fill in the pieces below.

Problem Description:  Define precisely what your program calculates, the input, and the output.
 
 

The Algorithm:  This stage of the process requires you to think about how you'll solve the problem above (independent of a programming language).  Recall that we used the following formula to calculate Celsius (C) from Fahrenheit (F):  C = (5/9) (F - 32)
 
 
 
 
 
 

The Program:  Write the program in C.  We have provided the template for the program.

#include <stdio.h>

/*  Comments:
 
 
 
 

 */
int main(void){
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

    /* terminate the program */
    return 0;
}