c programming 4 -...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
Sheet1 Page 1 #include <stdio.h> int main() { #define NUMROWS 5 #define NUMCOLS 5 int val[NUMROWS] [NUMCOLS] = {8,3,9,0,10,3,5,17,1,1,2,8,6,23,1,15,7,3,2,9,6,14,2,6,0} int row1, row2, row3, row4, row5, col1, col2, col3, col4, col5 printf("Enter Row 1: %d %d %d %d %d", val[0][0], val[0][1], val[0][2], val[0][3], val[0][4]) printf("\nEnter Row 2: %d %d %d %d %d", val[1][0], val[1][1], val[1][2], val[1][3], val[1][4]) printf("\nEnter Row 3: %d %d %d %d %d", val[2][0], val[2][1], val[2][2], val[2][3], val[2][4]) printf("\nEnter Row 4: %d %d %d %d %d", val[3][0], val[3][1], val[3][2], val[3][3], val[3][4]) printf("\nEnter Row 5: %d %d %d %d %d\n", val[4][0], val[4][1], val[4][2], val[4][3], val[4][4]) row1=val[0][0]+val[0][1]+val[0][2]+val[0][3]+val[0][4]
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: row2=val[1][0]+val[1][1]+val[1][2]+val[1][3]+val[1][4] row3=val[2][0]+val[2][1]+val[2][2]+val[2][3]+val[2][4] row4=val[3][0]+val[3][1]+val[3][2]+val[3][3]+val[3][4] row5=val[4][0]+val[4][1]+val[4][2]+val[4][3]+val[4][4] printf(&quot;Row totals: %d, %d, %d, %d, %d&quot;, row1, row2, row3, row4, row5) col1=val[0][0]+val[1][0]+val[2][0]+val[3][0]+val[4][0] col2=val[0][1]+val[1][1]+val[2][1]+val[3][1]+val[4][1] col3=val[0][2]+val[1][2]+val[2][2]+val[3][2]+val[4][2] col4=val[0][3]+val[1][3]+val[2][3]+val[3][3]+val[4][3] col5=val[0][4]+val[1][4]+val[2][4]+val[3][4]+val[4][4] printf(&quot;\nColum totals: %d, %d, %d, %d, %d\n&quot;, col1, col2, col3, col4, col5) system(&quot;PAUSE&quot;) return 0 }...
View Full Document

This document was uploaded on 02/14/2008.

Ask a homework question - tutors are online