This preview shows pages 1–2. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.View Full Document
Unformatted text preview: CS2022 Introduction to C, Spring 2009 Homework 1 Deadline: Wednesday, January 28, 1.10pm Handing in your homework To hand in homework, email your C codes for problems 1 and 2 to email@example.com AND hand in a hard copy, plus a printed copy of the C codes, on/ before the deadline. Problem 0. Get a C compiler! (nothing to hand in) Problem 1. Your rst basic C program Write a C program factorial.c that takes in an integer n , and returns the factorial n ! , de ned by n ! = 1 2 3 n . Here is a sample run of the program. (Your program need not produce the exact output.) Enter the value of n: 5 The factorial of 5 is 120. Problem 2. C programs in Matlab Matlab is an important software for testing numerical algorithms. Some of its advantages are that it has plenty of built-in functions and it is easy to learn. There are various reasons why one might want to run C programs in Matlab. For example, one may already have reliable programs written in C already. Or perhaps one wants to write C code to get faster performance.already....
View Full Document
- Spring '08