StoneHaos

nikita_sr3

Jun 29th, 2020
1,458
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main(void) {
  6.     int n;
  7.     cin >> n;
  8.     int m = n, mn = 10, mni = 0;
  9.     for (int i = 0; m != 0; m /= 10, ++ i) {
  10.         if (m % 10 < mn) {
  11.             mn = m % 10;
  12.             mni = i;
  13.         }
  14.     }
  15.     int p = 1;
  16.     m = n;
  17.     for (int i = 0; m != 0; m /= 10, ++ i) {
  18.         if (i != 0 && i != mni)
  19.             p *= m % 10;
  20.     }
  21.     cout << "Zadanie 1: " << mn * (n % 10) << endl;
  22.     cout << "Zadanie 2: " << p << endl;
  23.     return 0;
  24. }
RAW Paste Data