Advertisement
Guest User

5503

a guest
Mar 30th, 2017
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.74 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. int main(void) {
  4.     int N, R, max, m2, m7, m14, i, num, result;
  5.     max = 0; m2 = 0; m7 = 0; m14 = 0;
  6.     scanf("%d", &N);
  7.  
  8.     for(i = 0; i < N; i++) {
  9.         scanf("%d", &num);
  10.         if(num % 2 == 0 && num % 7 != 0 && num > m2)
  11.             m2 = num;
  12.         if(num % 2 != 0 && num % 7 == 0 && num > m7)
  13.             m7 = num;
  14.         if(num % 14 == 0 && num > m14)
  15.             m14 = num;
  16.         if(num > max)
  17.             max = num;
  18.     }
  19.  
  20.     scanf("%d", &R);
  21.     if(m2*m7 < m14*max)
  22.         result = m14*max;
  23.     else
  24.         result = m2*m7;
  25.    
  26.     printf("Calculated value: %d\n", result);
  27.     if(R == result)
  28.         printf("Success");
  29.     else
  30.         printf("Incorrect");
  31.     return 0;
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement