CSCI 151 Fall 2009 Lab 3 Assignment

Important! Submission Procedure: You have to show me the output of the program and to submit the printout of the source file.

Important! You have to finish your work during the regular lab time

Lab 3 Assignment constists of TWO programs.


Important: Start your program with comments part that includes:
your first and last names
your e-mail
today's day
the name of the program source file
the short description what this program is doing
list of the variables with the short description for each variable - name, type, purpose (this part could be done in the program by adding comment after each variable declaration).
  1. You should be in lab3 directory under CSCI151 directory

  2. Problem 1 (50 points): Write a C program lab3Test1.c that reads four integers and caclulates the sum, product, and the average of the input numbers. Since, we are working with the integers your average will be the integer part of the real average value. You don't need to use decimal point arithmetics in this program. The output of the program will include: your name and the caclulated results with the appropriate message. The results should be printed on different lines.

  3. After you finished writing , compile (type: gcc lab3Test3.c) and run (type: a.out) your program to check that your program returns a correct output. Run your program at least three times before you submit the printout of the source file and show me the output.

    Submission Step:

  4. Program (50 points): Write a C program lab3Test2.c that reads two 4-digits positive integers. The program finds the sum of the digits of the first input number and the product of the digits of the second input number.