[ create a new paste ] login | about

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

C, pasted on Apr 10:
char *itoa( const int num ,char* buf, const int ignore )
{
  const char table[] = "0123456789";
  char *p = buf;
  int tmp;

  for(tmp=num;tmp>0;tmp /= 10) *p++;
  *p='\0';
  for(tmp=num;tmp>0;tmp /= 10) *--p=table[tmp%10];

  return buf;
}

int main()
{
  char buf[99];
  int aho;

  for(aho=1; aho<50; aho++){
    if( aho%3==0 || aho%5==0 ||
        strchr(itoa(aho,buf,10),'3')) printf("%d\n",aho);
  }
  return 0;
}


Output:
3
5
6
9
10
12
13
15
18
20
21
23
24
25
27
30
31
32
33
34
35
36
37
38
39
40
42
43
45
48



Create a new paste based on this one


Comments: