[ create a new paste ] login | about

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

C, pasted on Jun 27:
#include <stdio.h>
#include <stdlib.h>

# define BUFFER_SIZE (256)
int get_int(void) {
  char buf[BUFFER_SIZE];
  fgets(buf, BUFFER_SIZE, stdin);
  return atoi(buf);
}

int main()
{
  int a, b, n, i;
  printf("a = ");
  a = get_int();
  printf("b = ");
  b = get_int();
  n = 0;
  for (i = a; i <= b; i++) {
    if (i % 2 != 0 && i % 3 != 0 && i % 5 != 0) {
      printf("%d,", i);
      n++;
    }
  }
  putchar('\n');
  printf("n = %d\n", n);
  return 0;
}
/* end */


Output:
1
2
a = b = 
n = 0


Create a new paste based on this one


Comments: