CSE 271: Homework 2
Assigned: 26 January 2007
Due: 31 January 2007, in class, on paper.
- Which of the following are invalid variable names? Why?
- Int
- Printf
- floating
- ReInitialize
- char
- Xx
- _1312
- _
- 6_05
- alpha-beta-routine
- A$
- $B
- Write a program to evaluate the polynomial:
2x3 - 5x2 + 6
for any value of x, which should be of type float.
- The factorial of an integer n, written n!, is the
product of the consecutive integegers 1 through n. For example,
5 factorial is calculated as
5! = 5 x 4 x 3 x 2 x 1 = 120
Write a program that generates the appropriate output (similar to that
above), when looping through the first 10 factorials.
Last revised: 23 January 2007.