All pastes #1382133 Raw Edit

Hoppity Hop (division-free)

public c v1 · immutable
#1382133 ·published 2009-04-04 21:39 UTC
rendered paste body
/* * Completely division-free implementation of Hoppity Hop. :-) * Copyright (c) 2009 Chris K. Jester-Young; GPLv3+. */#include <stdio.h>static const char *const text = "Hoppity\nHophop\nHoppity\nHoppity\nHophop\nHoppity\nHop";static const int offs[] = {0, 0, 0, 8, 8, 15, 23, 23, 23, 31, 38, 38, 46, 46, 46};intmain(int argc, char **argv){    int n;    FILE *fp;    if (argc < 2 || !(fp = fopen(argv[1], "r")) || !fscanf(fp, "%d", &n))        return 1;    fclose(fp);    for (; n >= 15; n -= 15)        puts(text);    printf("%.*s", offs[n], text);    return 0;}