#include <stdio.h>

int main() {
    int n,sum=0,constructor;
    int no_con=1;
    scanf("%d",&n);
    for (int i=1; i<n; i++) {
        constructor=i;
        sum=constructor;
        while(constructor>0) {
            sum+=constructor%10;
            constructor=constructor/10;
        }
        if(sum==n) {
            printf("%d",i);
            return 0;
        }
    }
    if(no_con) {
        printf("0");
    }
    return 0;
}

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: