Advertisement
dllbridge

Задача 7 (2)

Sep 6th, 2020
1,759
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.85 KB | None | 0 0
  1.  
  2. #include <iostream>
  3. using namespace std;
  4.  
  5.  
  6. ///////////////////////////////////////////////////////
  7. int main()                                           //
  8. {
  9.    
  10.     setlocale(LC_ALL, "Rus");
  11.    
  12.     int i, mk7 = 0, max = 0, mpr = 0, x, res, n = 0;
  13.    
  14.     do{
  15.          cin >> x;
  16.          
  17.          if((x%7 == 0)&&(x%49 != 0)  &&(x > mk7)) mk7 = x;
  18.          if((x  > max)&&(x% 7 != 0)) max = x;
  19.          n++;
  20.          
  21.     } while(x != 0);
  22.    
  23.     cin >> res;
  24.    
  25.     mpr = mk7 * max;
  26.     if(mpr == 0) mpr = 1;
  27.    
  28.     cout << "Введено чисел: "       << n-1 << endl;
  29.     cout << "Контрольное значение " << res << endl;
  30.     cout << "Вычисленное значение " << mpr << endl;
  31.     cout << "Значения "; if(res != mpr) cout << "не ";
  32.     cout << "совпали"  ;
  33.  
  34. return 0;
  35. }
  36.  
  37.  
  38.  
  39.  
  40.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement