This preview shows pages 1–2. Sign up to view the full content.
ECE2801 HW #1 C programming and Binary Number
Representations
(DUE 9/4/09 At the BEGINNING of class)
To assure proper grading and return, be sure to attach the HW cover sheet!
•
Always review any reading assignments
before
attempting the homework
problems.
•
Show all of your work. Clearly indicate results (underline, circle or box)
•
Always write neatly.
The grader can not be expected to GUESS what you
meant to do!
Problem #1 (20 pts)
a)
How many times
would each loop actually iterate on the MSP430C449?
Explain you
reasoning.
unsigned int
cnt= 1;
while (cnt > 0)
cnt++;
unsigned int
j, P, Q, first=0, last = 10,000;
for (j=first; j < last; j++)
{
Q = lastj;
P = somefunc(Q);
}
What is the value of
Q
in the first loop, in the final loop?
b)
Write a complete C program that will calculate the mean, the mean of the
squares and the square of the mean of 10 real numbers.
Your main should assign
the values of the numbers to a globally defined array and then call 3 functions
(you may assign static numbers to your array for this HW. The MSP430 doesn't
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
This is the end of the preview. Sign up
to
access the rest of the document.
 Fall '08
 Jarvis
 C Programming

Click to edit the document details