[ create a new paste ] login | about

Link: http://codepad.org/LFWobgAN    [ raw code | output | fork ]

C, pasted on Jul 20:
#include <stdio.h>
#include <string.h>
void countd(int x, char* digs){
    while(x){
        ++digs[x%10];
        x/=10;
    }
}
char compared(char* s1, char* s2){
    int i;
    for(i=1;i<10;++i){
        if(s1[i]!=s2[i]) return 0;
    }
    return 1;
}
int main(){
    int i=0;
    char digs1[10]={0};
    char digs2[10]={0};
    for(i=0;i<1000;++i){
        countd(i,digs1);
        countd(2*i,digs2);
        if(compared(digs1,digs2)==1) printf("%d",i);
        memset(digs1,0,10);
        memset(digs2,0,10);
    }
    return 0;
}


Output:
1
0


Create a new paste based on this one


Comments: