STANAANDREY

DIFMIN

May 6th, 2019
173
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.47 KB | None | 0 0
  1. #include <iostream>
  2. #include <cmath>
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.   int a[100][100],c1,c2,n,i,j,v[100],mini;
  8.  
  9.   cout<<"n=";cin>>n;
  10.   for (i=0;i<n;i++)
  11.     for (j=0;j<n;j++)
  12.     cin>>a[i][j];
  13.   cout<<"c1=";cin>>c1;
  14.   cout<<"c2=";cin>>c2;
  15.   mini=a[c1][0];
  16.   for (i=1;i<n;i++)
  17.   if (mini>a[c1][i])
  18.  mini=a[c1][i];
  19.  
  20. for (i=0;i<n;i++)
  21. v[i]=abs(mini-a[c2][i]);
  22. mini=v[0];
  23. for (j=1;j<n;j++)
  24.     if (mini>v[j])
  25.    mini=v[j];
  26.  
  27. cout<<mini;
  28.     return 0;//
  29. }
Add Comment
Please, Sign In to add comment