Lab9 - #include <stdio.h> int main(...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
Tao Lin EE140 Lab 9 Q1: a. int x[2][5]; b. 2 rows and 5 columns c. 10 elements d. x[1][0] x[1][1] x[1][2] x[1][3] x[1][4] e. x[0][2] x[1][2] f. x[1][2]=0; Q2: #include <stdio.h> void display( int ary[][100], int row, int column) { int i,j; for (i=0;i<row;i++) { for (j=0;j<column;j++) { printf( "%d\t" ,ary[i][j]); } printf( "\n" ); } } int main( void ) { int x[100][100]={{1,2,3,4,5,6},{2,3,4,5,6,7},{3,4,5,6,7,8}, {4,5,6,7,8,9}}; int m=4,n=6; display(x,m,n); return 0; } RESULT: 1 2 3 4 5 6 2 3 4 5 6 7 3 4 5 6 7 8 4 5 6 7 8 9 Press any key to continue . . .
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: #include &lt;stdio.h&gt; int main( void ) { int x[5][6]; int i,j,count; for (i=0;i&lt;4;i++) { for (count=0;count&lt;5;count++) { printf( &quot;Enter salesperson %d's sale for %d products: &quot; ,i+1,count+1); scanf( &quot;%d&quot; ,&amp;x[i][count]); x[i][5]+=x[i][count]; } } for (j=0;j&lt;6;j++) for (i=0;i&lt;4;i++) x[4][j]+=x[i][j]; for (i=0;i&lt;5;i++) { for (j=0;j&lt;6;j++) { printf( &quot;%d\t&quot; ,x[i][j]); } printf( &quot;\n&quot; ); } return 0; }...
View Full Document

Page1 / 2

Lab9 - #include &amp;amp;lt;stdio.h&amp;amp;gt; int main(...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online