C Programming

EXERCISE C13
Given a two dimensional array write a program that totals all elements printing the total.


	#include <stdio.h>

	main()
	{
		static int m[][] = { {10,5,-3}, {9, 0, 0}, {32,20,1}, {0,0,8} };
		int row, column, sum;

		sum = 0;
		for( row = 0; row < 4; row++ ) 
			for( column = 0; column < 3; column++ ) 
				sum = sum + m[row][column];
		printf("The total is %d\n", sum );
	}


CLASS EXERCISE C14
They get initialised to ZERO.


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