A Program for accepting values to 2-Dimensional array and finding the sum of all the elements of 2-Dimensional array.
A Program for accepting values to 2-Dimensional array and finding the sum of all the elements of 2-Dimensional array. Just copy and paste the code below and compile and run the program. #include<stdio.h> #include<conio.h> void main() { int a[3][3],i,j,s=0; clrscr(); for(i=0;i<3;i++) { for(j=0;j<3;j++) { printf("\nEnter a value:"); scanf("%d",&a[i][j]); } } printf("\nYour array\n"); for(i=0;i<3;i++) { for(j=0;j<3;j++) { s=s+a[i][j]; printf("%d\t",a[i][j]); } } printf("\nSum of array elements=%d",s); getch(); }