Advertisement
Guest User

kakoe-to zadanie

a guest
Oct 18th, 2019
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.31 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3. int main() {
  4. int a, b, c, d, s;
  5. for(int n = 1000; n<10000;) {
  6.     a=n/1000;
  7.     b=n/100%10;
  8.     c=n/10%10;
  9.     d=n%10;
  10.     s=a+b+c+d;
  11.     if(s==15){
  12.         cout << n << endl;
  13.         n++;
  14.         }
  15.         else {
  16.         n++;
  17.         }
  18.     }
  19. return 0;
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement