View Code of Problem 3831

#include <stdio.h>

int main() {
    int a,b,c,d;
    int i;
    int x, x1, m;
    while(scanf("%d %d %d %d",&a,&b,&c,&d)!=EOF) {
        for(i=1;i<82;i++) {
            x = (a+i)*(b+i)*(c+i)*(d+i);
            x1 = x;
            m=0;
            while(x1) {
                m += x1%10;
                x1 /= 10;
            }
            if(m == i) {
                printf("%d\n",x);
                break;
            }
        }
    }
}

Double click to view unformatted code.


Back to problem 3831