Always hand in:
- written solutions to any questions
- a paper print-out of well-commented code. Include a multiline comment at
the top of your code with (i) the assignment name, (ii) your name,
and (iii) the date you handed in all elements of the assignment
- paper print-out of output (graph or text)
- also, e-mail me (y-lithwick@northwestern.edu) the code with your name and
the exercise number in the subject line
Assignment #1 [5 points, due 2pm, April 3]
- DON'T FORGET TO ASK GRANT (F219) FOR A KEY TO LAB, ASAP
-
For this assignment, you may only use the following
C keywords: main, double, int, while
as well as the following words needed for outputting:
include, stdio.h,
printf, fprintf, FILE, fopen, fclose, %lf, %d
- Write a code that
outputs f(n) = n2-n-1,
for n = 0,1,2,...30. The output should be integers.
-
Plot f(x)= x2-x-1 vs. x, where x is real
(actually double), and hand in plot. From the plot, what
are the solutions of f(x)=0?
Compare with the analytical solutions.
- [This question is not for credit:]
Write a code that outputs the following triangle, where the number
of rows should be arbitrary:
*
**
***
****
*****
******
*******
********
*********
- [This question is not for credit:]
Work through the
online C tutorial up to
c_027b.html, i.e. up to (but not including)
switch/case.