Advertisement
Guest User

Untitled

a guest
Mar 28th, 2020
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3. int main()
  4. {
  5.  
  6. int tmp = 0;
  7. int tmp2 = 0;
  8. int tmp3 = 0;
  9. for (int i = 100; i < 1000; i++) {
  10. tmp = i / 100; //wraca liczbe setek
  11. if (tmp == 1 || tmp == 2 || tmp == 5 || tmp == 6 || tmp == 7 || tmp == 9) {
  12. tmp2 = (i / 10) % 10; //zwraca liczbe dziesiątek
  13. if (tmp2 == 1 || tmp2 == 2 || tmp2 == 4 || tmp2 == 8) {
  14. tmp3 = i % 10; //zwraca liczbe jednosci
  15. if (tmp3 % 2 == 0) {
  16.  
  17. if ((tmp + tmp2 + tmp3) % 7 == 0) {
  18. cout << i << endl;
  19. }
  20. }
  21.  
  22. }
  23. }
  24. }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement