Kacper_Michalak

Zadanie funkcje 11

Jan 26th, 2021 (edited)
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.44 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. void  PODZIELNOSC(int x, int y)
  5. {
  6.     int i=1;
  7.     int tymczasowa;
  8.    
  9.     if (x > 1)
  10.     {
  11.         for (int j = 0; j < x-1; j++)
  12.         {
  13.             i *= 10;
  14.         }
  15.        
  16.     }
  17.     tymczasowa = i * 10;
  18.  
  19.         do
  20.         {
  21.             if (i % y == 0)
  22.             {
  23.                 cout << i << " ";
  24.             }
  25.             i++;
  26.         } while (i < tymczasowa);
  27.    
  28.     cout << "\n";
  29. }
  30.  
  31. int main()
  32. {
  33.     PODZIELNOSC(1, 4);
  34.     PODZIELNOSC(2, 6);
  35.     PODZIELNOSC(3, 8);
  36.     PODZIELNOSC(4, 92);
  37.  
  38. }
Advertisement
Add Comment
Please, Sign In to add comment