All pastes #989693 Raw Edit

Something

public text v1 · immutable
#989693 ·published 2008-04-19 16:39 UTC
rendered paste body
#include <stdio.h>

int d_n(int n)
        {
                int res = 0;
                while ((n / 10) > 0) {
                res += (n % 10);
                n = (n / 10);
                }
                res += n;
                return res;
        }
int check_self(int z, int v)
        {
                int res = 1, i;
                for (i = (z - 81); i <= z; i++)
                        if ( d_n(v) == i)
                                res = 0;
                return res;
        }
void swap (int a, int b)
        {
        int c;
        c = a; a = b; b = c;
        }
main ()
{
        int x=0, a, i, j;
        printf("self ");
        scanf("%d1 %d2", i, j);
        if (i > j) swap(i,j);
        for (a = i; a <= j;a++) if (check_self(i,j) == 1) x++;
        printf("&d", x);
}