Answer: EXERCISE C6
#include <stdio.h> main() { int n = 1, t_number = 0; for( ; n <= 200; n++ ) t_number = t_number + n; printf("The 200th triangular_number is %d\n", t_number); }
Answer: CLASS EXERCISE C7
a == 2 equality test a = 2 assignment
Answer: CLASS EXERCISE C8
The inclusion of the 2 in the %d statements achieves a field
width of two places, and prints a leading 0 where the value is
less than 10.
Answer: EXERCISE C9
#include <stdio.h> main() { int n = 1, t_number = 0, input; printf("Enter a number\n"); scanf("%d", &input); for( ; n <= input; n++ ) t_number = t_number + n; printf("The triangular_number of %d is %d\n", input, t_number); }