Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main() {
- int a, b, c, d, s;
- for(int n = 1000; n<10000;) {
- a=n/1000;
- b=n/100%10;
- c=n/10%10;
- d=n%10;
- s=a+b+c+d;
- if(s==15){
- cout << n << endl;
- n++;
- }
- else {
- n++;
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement