KarolWozniak

Zadanie 8

Mar 18th, 2020
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.78 KB | None | 0 0
  1. #include <iostream>
  2. #include <math.h>
  3. // Karol Woźniak 18.03.2020r
  4. using namespace std;
  5.  
  6. int liczba1, liczba2;
  7.  
  8. int PODZIELNOSC(int a, int b)
  9. {
  10.     int i,j;
  11.  
  12.     if(a==1)
  13.     {
  14.         for(i=1; i<=9; i++)
  15.         {
  16.             if(i%b==0)
  17.             {
  18.                 cout << i << " ";
  19.             }
  20.         }
  21.     }
  22.     else
  23.     {
  24.         j=pow(10,a);
  25.         j=j-1;
  26.         a=a-1;
  27.         i=pow(10,a);
  28.         for(i;i<=j;i++)
  29.         {
  30.             if(i%b==0)
  31.             {
  32.                 cout << i << " ";
  33.             }
  34.         }
  35.     }
  36.  
  37. }
  38.  
  39. int main()
  40. {
  41.     cout << "Podaj ilocyfrowe liczby cie interesuja: ";
  42.     cin >> liczba1;
  43.     cout << "Podaj, przez co maja byc podzielone: ";
  44.     cin >> liczba2;
  45.     PODZIELNOSC(liczba1, liczba2);
  46.     return 0;
  47. }
Advertisement
Add Comment
Please, Sign In to add comment