Advertisement
Guest User

Untitled

a guest
Apr 8th, 2020
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.67 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.     int x, najmniejsza_podst = 0;
  8.     cout << "Podaj iloœæ liczb, które chcesz wprowadziæ: ";
  9.     cin >> x;
  10.     int tab[x];
  11.     for (int i = 0; i < x; i++)
  12.     {
  13.         do
  14.         {
  15.             cout << "Podaj liczbê z przedzia³u od 0 do 9 o indeksie " << i << ": ";
  16.             cin >> tab[i];
  17.         } while (tab[i] > 9 || tab[i] < 0);
  18.         if (najmniejsza_podst < tab[i])
  19.             najmniejsza_podst = tab[i];
  20.     }
  21.     najmniejsza_podst++;
  22.     int wyjscie = 0;
  23.     for (int i = 0; i < x; i++)
  24.     {
  25.         wyjscie = wyjscie * najmniejsza_podst + tab[i];
  26.     }
  27.     cout << wyjscie;
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement