Thursday, August 21, 2008

C Assignments #1

Review Questions:

1. What are some uses for comments?
2. Why is indentation important?
3. What are the largest & smallest values that can be stored in an int type variable?
4. What is the difference between the constants 7, '7', and "7"?
5. What is the difference between the constants 123 and "123"?
6. What is the function of the semicolon in a C statement?
7. State the various data types in C language.
8. Explain why the largest value that can be stored in an int type variable is 32767?

Programming Exercises:

1. Write a program to print the numbers from 1 to 10 and their squares:

1 1
2 4
3 9
...
10 100

2. Write a program to print this triangle:

*
**
***
****
*****
******
*******
********
*********
**********

Don't use ten printf statements.


3. What would be the equivalent code, using a while loop, for the following example ?

for(i = 0; i < i =" i" i =" 0;" i =" i" style="font-weight: bold;">Programming exrcises 5, 7 and 8 are for journal.
Post a Comment