kingstertime

Untitled

Jan 11th, 2021
448
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <assert.h>
  2. #include <limits.h>
  3. #include <math.h>
  4. #include <stdio.h>
  5. #include <stdlib.h>
  6.  
  7. int
  8. main (int argc, char *argv[])
  9. {
  10.   assert (argc - 1 == 1);
  11.   long n;
  12.   {
  13.     char *tail;
  14.     n = strtol (argv[1], &tail, 0);
  15.     assert (tail > argv[1]);
  16.     assert (*tail == '\0');
  17.   }
  18.  
  19.   assert (n >= 1);
  20.   assert (n <= sqrt (LONG_MAX));
  21.   const int width = (int)ceil (2 * log (1 + n) / log (10));
  22.  
  23.   long i;
RAW Paste Data