title: Type specification in Crystal
body: <p>I'm new to Crystal and i'm trying to translate the following program to Crystal:</p>
  <pre class="lang-c prettyprint-override"><code>#include &lt;stdio.h&gt;
  
  long rev(long n) {
    long m = 0;
    while (n &gt; 0) {
      m = 10*m + n%10;
      n = n/10;
    }
    return(m);
  }
  
  int main() {
    for(int n=1; n&lt;=10000000; n++) {
      long m = n*rev(n);
      if (m==rev(m))
        printf(&quot;%d\n&quot;, n);
    }
  }
  </code></pre>
  <p>I wrote the Crystal program</p>
  <pre class="lang-crystal prettyprint-override"><code>def rev(n : UInt64) : UInt64
    m : UInt64 = 0
    while n &gt; 0
      m = 10_u64*m + n%10_u64
      n = n//10
    end
    m
  end
  
  (1_u64 .. 10_000_000).each { |n|
    m = n*rev(n)
    if m == rev(m)
      print(n,&quot;\n&quot;)
    end
  }
  </code></pre>
  <p>I found odd that, in order to compile, at some points I had to specify the type of the literals  (<code>n%10_u64</code>) but in others don't (<code>n//10</code>). I'm I missing something or just Crystal is not consistent about casting?</p>
  <p>Also, I like to know, is this a good translation of the c program or how an experienced Crystal programmer would do it?</p>