- Send your homework (ZIP or RAR file) to TA at
cs101-ta@voip.edu.tw
- Deadline:2007/12/21 11:00 AM
- Subject of email: [CS101 HW12] 91234567
- Create New Project
- Choose Project types and Templates
- Name:
- HW12_1_91234567
- HW12_2_91234567
- Compress the folder to a ZIP or RAR file
-
HW12_1
(From: Exercise 1 on P.269)
The factorial of 4 (written as 4!) is 4*3*2*1 = 24, and 3! is
3*2*1 = 6, so it follows that 4! = 4*3!, or more generally:
fact(n) =
n*fact(n-1).
The limiting case is when n is 1, 1! = 1. Write a
recursive function which calculates factorials, and test it.
-
HW12_2
(From: Exercise 3 on P.269)
The trigonometry functions (sin(),
cos(), and tan()) in the standard
math library take arguments in radians. Write three equivalent
functions, called sind(),
cosd(), and tand(), which takes arguments
in
degrees. All arguments and return values should be type double.
(You may need to include <math.h>
if necessary.)