title: Write a program in C to print armstrong numbers from 1 to 10000
body: <p>This is the program I wrote. I get a blank output when I execute it. Can't figure out what's wrong with it.  </p>
  
  <pre><code>#include &lt;stdio.h&gt;
  void main() {
  int a, b = 0, s, n;
  printf("The armstrong numbers are-");
  for (n = 1; n &lt;= 10000; n++) {
    s = n;
    while (n &gt; 0) {
      a = n % 10;
      b = b + a * a * a;
      n = n / 10;
    }
    if (b == s)
      printf("%d ", s);
  }
  }
  </code></pre>