C Assignment # 11. 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 < 10; i = i + 1)
printf("i is %d\n", i);
4.What would this code print?
int i;
for(i = 0; i < 3; i = i + 1)
printf("a\n");
printf("b\n");
printf("c\n");
5. Write a program to compute the average of the ten numbers 1, 4, 9, ..., 81, 100, that is, the average of the squares of the numbers from 1 to 10.
6. Write a program to print the numbers between 1 and 10, along with an indication of whether each is even or odd, like this:
1 is odd
2 is even
3 is odd
...
7. Write a program to print the first 7 positive integers and their factorials in this form:
1! = 1
2! = 2
3! = 6
4! = 24, etc
8. Write a program to print the first 10 Fibonacci numbers. Each Fibonacci number is the sum of the two preceding ones. The sequence starts out 0, 1, 1, 2, 3, 5, 8, ...