#include<stdio.h>
#include<iostream>
using namespace std;
int main()
{
int a[10][10],m,n,d,s,sum=0,e=0,f=0;
cout<<"enter the no. of companie";
cin>>n;
cout<<"enter the no. of warehouse";
cin>>m;
for(e=1;e<=m;e++)
{
for(f=1;f<=n;f++)
{
cout<<"enter values of warehouse and company"<<m<<n;
cin>>a[e][f];
}
}
for(e=1;e<=m;e++)
{
cout<<"Enter value of supply";
cin>>s;
}
for(f=1;f<=n;f++)
{
cout<<"enter value of demand";
cin>>d;
}
while(e<m)
{
if(d[e]<s[f])
{
s[f]=s[f]-d[e];
sum=sum+(s[f][e]*d[e])
e=e+1;
}
else
{
if(d[e]>s[f])
{
d[e]=d[e]-s[f];
sum=sum+(s[f][e]*s[f])
f=f+1;
}
else
{
if(d[e]==s[f])
{
d[e]=d[e]-s[f];
sum=sum+(s[f][e]*s[f])
f=f+1;
e=e+1;
}
}
}
}
cout<<"the optimal solution is:";
cin>>sum;
}
Thank You!!