#include main() { int a[2][5]={1,2,3,4,5,6,7,8,9,10}; int i,j,sum=0; for(i=0;i<2;i++) { for(j=0;j<5;j++) { sum=sum+a[i][j]; } } printf("Sum of all elements from a 2D array is: %d\n", sum); getch(); }
/* Example of inner loop */ /* Author name:Md-Naimul Hasan shohan */ #include using namespace std; void addition(int m,int n) { int i,j,sum[10][10],a[10][10],b[10][10]; cout<<"Enter element for first array:"<>a[i][j]; } }
cout<<"Enter element for second array:"<>b[i][j]; } }
cout<<"Your first entered element is:"<>m; cout<<"Enter the coloumn size:"<>n; addition(m,n); return 0; }
#include
উত্তরমুছুনmain()
{
int a[2][5]={1,2,3,4,5,6,7,8,9,10};
int i,j,sum=0;
for(i=0;i<2;i++)
{
for(j=0;j<5;j++)
{
sum=sum+a[i][j];
}
}
printf("Sum of all elements from a 2D array is: %d\n", sum);
getch();
}
#include
উত্তরমুছুন#include
main()
{
int arra[2][5]={{2,5,7,10,2},
{14,16,2,2,5}};
int i,j;
for( i=0;i<2;i++)
{
for( j=0;j<5;j++)
{
printf("%d ",arra[i][j]);
}
printf("\n");
}
}
#include
উত্তরমুছুনmain()
{
int t[2][5]={2,3,4,7,8,1,2,10,15,16};
int raw,col,sum=0;
for(raw=0;raw<2;raw++)
{
for(col=0;col<5;col++)
{
sum=sum+t[raw][col];
}
}
printf("%d\n",sum);
}
#include
main()
{
int t[2][5]={2,3,4,7,8,1,2,10,15,16};
int raw,col,sum=0;
for(raw=0;raw<2;raw++)
{
for(col=0;col<5;col++)
{
sum=sum+t[raw][col];
}
}
printf("%d\n",sum);
#include
main()
{
int t[2][5]={2,3,4,7,8,1,2,10,15,16};
int raw,col,sum=0;
for(raw=0;raw<2;raw++)
{
for(col=0;col<5;col++)
{
sum=sum+t[raw][col];
}
}
printf("%d\n",sum);
}
}
/* Example of inner loop */
উত্তরমুছুন/* Author name:Md-Naimul Hasan shohan */
#include
using namespace std;
void addition(int m,int n)
{
int i,j,sum[10][10],a[10][10],b[10][10];
cout<<"Enter element for first array:"<>a[i][j];
}
}
cout<<"Enter element for second array:"<>b[i][j];
}
}
cout<<"Your first entered element is:"<>m;
cout<<"Enter the coloumn size:"<>n;
addition(m,n);
return 0;
}