きったんの頭

/*
 * pe5.c
 * https://mind.kittttttan.info/c/pe5
 */

/* https://mind.kittttttan.info/c/gcd */
#include "gcd.h"

#include <stdio.h>
#include <stdlib.h>

void pe5(unsigned long n) {
  unsigned long i, d = 1;

  for (i = 2; i <= n; ++i) {
    d = lcm(d, i);
  }

  printf("%lu below %lu\n", d, n);
}

int main() {
  unsigned long n;

  puts("Problem 5:");
  while (1) {
    if (scanf("%lu", &n) != 1) {
      scanf("%*s");
      puts("Input Number.");
    } else {
      if (!n) {
        break;
      }
      pe5(n);
    }
  }

  return 0;
}