Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- using namespace std;
- int main() {
- int n; cin>>n;
- int ed=n%10;
- for(int a=1;a<=9;a++){
- for(int b=9;b>=a;b--) {
- for(int c=0;c<=9;c++){
- for(int d=9;d>=c;d--) {
- if((a+b+c+d)==(a*b*c*d))
- {
- if(ed==5) {cout<<a<<b<<c<<d<<endl; return 1;}
- }
- if(((a*b*c*d)/(a+b+c+d))==3) {
- if(n%3==0){
- if(d>0) {cout<<d<<c<<b<<a<<endl; return 1;}
- }
- }
- }
- }
- }
- }
- cout<<"Nothing found\n";
- return false;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement