CCCPaste

Untitled

#include 
#include 

int main(){
    int N;
    scanf("%d", &N);
    if(N <= 9) {
        printf("Brojot ne e validen");
        return 0;
    }
     // 0
    for(int i = N - 1; i >= 0; i--) {
        int broj = i;
        int obraten_broj = 0;
        int broj_na_cifri = 0;
        
        while(broj > 0) {
            int cifra = broj % 10;
            obraten_broj = (obraten_broj * 10) + cifra;
            broj /= 10;
            broj_na_cifri++;
        }
        
        if(obraten_broj % broj_na_cifri == 0) {
            printf("%d\n", i);
            return 0;
        }
        
    }
    return 0;

}