Created
September 16, 2014 17:18
-
-
Save shohan4556/d9875dad6bf29618b14f to your computer and use it in GitHub Desktop.
initilize a two-D array and sum it
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
void main() | |
{ | |
int i,j,array[4][4],sum=0; | |
for(i=0;i<4;i++){ | |
for(j=0;j<4;j++){ | |
array[i][j]=j; // initializing array | |
} | |
} // end of initialoze array | |
for(i=0;i<4;i++){ | |
for(j=0;j<4;j++) | |
sum=sum+array[i][j]; // add elements of the array | |
} | |
printf ("%d\n",sum); // prints all all element's addition | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment