Advertisement
PiotrJurek

Zad8

Mar 29th, 2020
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. void PODZIELNOSC(int iloCyfrowe, int przezCoPodzielne)
  6. {
  7. if(przezCoPodzielne==0)
  8. {
  9. cout << "Nie dziel przez ZERO!" << endl;
  10. }
  11. else
  12. {
  13. int maks = 1;
  14. for (int i = 0; i<iloCyfrowe; i++)
  15. {
  16. maks*=10;
  17. }
  18. int mini = ((maks/10)-1)/przezCoPodzielne;
  19. mini = (mini+1)*przezCoPodzielne;
  20. for(int i=mini; i<maks; i=i+przezCoPodzielne)
  21. {
  22. cout << i << " ";
  23. }
  24. }
  25. }
  26.  
  27. int main()
  28. {
  29. int a, b;
  30. cout << "Ilo cyfrowe liczby:" << endl;
  31. cin >> a;
  32. cout << "Przez co maja sie dzielic:" << endl;
  33. cin >> b;
  34. PODZIELNOSC(a, b);
  35. return 0;
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement