Advertisement
Guest User

Untitled

a guest
Oct 19th, 2017
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.40 KB | None | 0 0
  1. // Algorytm 3
  2. // a - początek przedziału
  3. // b- koniec przedziału
  4. // c - zmienna dodatkowa, do sprawdzania podzielności przez 3
  5. #include <iostream>
  6. #include <string>
  7. using namespace std;
  8.  
  9. int main()
  10. {
  11. int a,b,c;
  12. cout << "a=";
  13. cin >> a;
  14. cout << "b=";
  15. cin >> b;
  16. while(b<a){
  17. cout << "b=";
  18. cin >> b;
  19. }
  20. for(c=a;c<=b;c++){
  21. if(c%3==0){
  22. cout << c << ", ";
  23. }
  24. }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement