Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- int tmp = 0;
- int tmp2 = 0;
- int tmp3 = 0;
- for (int i = 100; i < 1000; i++) {
- tmp = i / 100; //wraca liczbe setek
- if (tmp == 1 || tmp == 2 || tmp == 5 || tmp == 6 || tmp == 7 || tmp == 9) {
- tmp2 = (i / 10) % 10; //zwraca liczbe dziesiątek
- if (tmp2 == 1 || tmp2 == 2 || tmp2 == 4 || tmp2 == 8) {
- tmp3 = i % 10; //zwraca liczbe jednosci
- if (tmp3 % 2 == 0) {
- if ((tmp + tmp2 + tmp3) % 7 == 0) {
- cout << i << endl;
- }
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement