C Programming

EXERCISE C6
Rewrite the previous program by calculating the 200th triangular number, and make the program shorter (if possible).


CLASS EXERCISE C7
What is the difference between the two statements,


	a == 2
	a = 2


CLASS EXERCISE C8
Change the printf line of the above program to the following,


	printf(" %2d           %2d\n",n,t_number);

What does the inclusion of the 2 in the %d statements achieve?


EXERCISE C9
Create a C program which calculates the triangular number of the users request, read from the keyboard using scanf(). A triangular number is the sum of the preceding numbers, so the triangular number 7 has a value of

7 + 6 + 5 + 4 + 3 + 2 + 1

Answers


©Copyright B Brown. 1984-1999. All rights reserved.