Guest User

Untitled

a guest
Dec 24th, 2013
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <stdio.h>
  2. #include <time.h>
  3. #include <windows.h>
  4.  
  5. int main()
  6. {
  7.     srand(time(NULL));
  8.     bool f;
  9.     int A[75]={0};
  10.     for (int i=0; i<75; i++)
  11.     {
  12.         f=rand()%2;
  13.         if (f)
  14.             A[i]=rand()%21;
  15.         else
  16.             A[i]=(-1)*(rand()%6);
  17.     }
  18.     int x,y;
  19.     int max=-6;
  20.     for (int i=0; i<75; i++)
  21.         for (int j=0; j<75; j++)
  22.             if (A[i]-A[j]>max)
  23.             {
  24.                 x=i; y=j;
  25.                 max=A[i]-A[j];
  26.             }
  27.     printf("%d ",A[x]);
  28.     printf("%d ",A[y]);
  29.     printf(" left-right= %d",A[x]-A[y]);
  30.     return 0;
  31. }
Advertisement
Add Comment
Please, Sign In to add comment