Advertisement
Lukasz_Miskiewicz

Zadanie 8

Mar 24th, 2020
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1. #include <iostream>
  2. #include <math.h>
  3. using namespace std;
  4.  
  5. int podzielnosc(int a, int b)
  6. { int c, d;
  7. if (a==1)
  8. {
  9. for (d=1; d<=9; d++)
  10. {
  11. if (d%b==0)
  12. {
  13. cout<<d<<" ";
  14. }
  15. }
  16. }
  17. else {
  18. c=pow(10,a);
  19. c=c-1;
  20. a=a-1;
  21. d=pow(10,a);
  22. for (d; d<=c; d++)
  23. {
  24. if(d%b==0)
  25. {
  26. cout<<d<<" ";
  27.  
  28. }
  29. }
  30. }
  31. }
  32.  
  33. int main()
  34. {
  35. int a,b;
  36. cout<<"podaj ilo cyfrowe liczby cie interesuja"<<endl;
  37. cin>>a;
  38. cout<<"podaj przez co maja sie dzielic"<<endl;
  39. cin>>b;
  40. podzielnosc(a,b);
  41. return 0;
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement