<email snipped and color code tags deleted> this is the solution for this problem its kinda long and boring ,but it works properly

#include <iostream>
#include <iomanip>
using namespace std;
void main()
{
	const int r=4, c=4;
	int ar1[r][c];
	int ar2[r][c];
	int sum[r][c];
	int prod[r][c];
	int s=0, y, x;
	cout<<"please enter the elements for the first (4x4) arry"<<endl;
	for(int i=0;i<r;i++)
	{
		for(int j=0;j<c;j++)
			cin>>ar1[i][j];
	}
	cout<<"please enter the elements for the second (4x4) arry"<<endl;
	for(int i=0;i<r;i++)
	{
		for(int j=0;j<c;j++)
			cin>>ar2[i][j];
	}
	for(int i=0;i<r;i++)
	{
		for(int j=0;j<c;j++)
			sum[i][j]=ar1[i][j]+ar2[i][j];
	}
	cout<<endl;
	cout<<" the first array is"<<endl;
	for(int i=0;i<r;i++)
	{
		cout<<endl;
		for(int j=0;j<c;j++)
			cout<<setw(5)<<ar1[i][j];
	}
	cout<<endl;
	cout<<" the second array is"<<endl;
	for(int i=0;i<r;i++)
	{
		cout<<endl;
		for(int j=0;j<c;j++)
			cout<<setw(5)<<ar2[i][j];
	}
	cout<<endl;
	cout<<" the sum of the Two arrays is "<<endl;
	for(int i=0;i<r;i++)
	{
		cout<<endl;
		for(int j=0;j<c;j++)
			cout<<setw(5)<<sum[i][j];
	}
	cout<<endl;
	for(int i=0;i<r;i++)
	{
		for(int j=0;j<c;j++)
		{
			y=0;
			for(int s=0;s<c;s++)
			{
				x=ar1[i][s]*ar2[s][j];
				y=y+x;
			}
			prod[i][j]=y;
		}
	}
	cout<<left;
	cout<<"the Product array is the followin"<<endl;
	for(int i=0;i<r;i++)
	{
		cout<<endl;
		for(int j=0;j<c;j++)
			cout<<setw(8)<<prod[i][j];
	}
	cout<<endl;
}

Recommended Answers

All 5 Replies

errr.. what? Is this a question or.. an answer to no question? I don't get it.

well , it's an answer for an existed question about 2D product arry
check it back

Why don't you reply to that thread then? :?

sorry my fault

post a link to the thread that this should have been an answer to and I'll fix it up for you. I can't tell what thread you were trying to answer.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.