Like this:

Code:
    while (c != '\n' && c != EOF && c != 'n') {
        c = getchar();
        scanf("%c", &input);
        if (input != 'n')
            printf("%d %d %d\n", rand() % 10, rand() % 10, rand() % 10);
    }