title: Euler's totient function in C
body: <p>For a natural number n, Euler's totient function is defined as the number of natural numbers in the set <code>{1,...n}</code> that are relatively prime with <code>n</code>. I have to write a program in C language so that for the input <code>n</code> the output is the Euler's totient function of <code>n</code>. 
  This was my attempt:</p>
  
  <pre><code>#include&lt;stdio.h&gt; 
  int main(void) {
  
  int n,k;
  
  scanf("%d", &amp;n);
  
  for (k=1; k&lt;n; k++) {
    if(n%k !=0) 
  
    printf("%d\n", k);
  
    }
  
  return 0;
  
  } 
  </code></pre>
  
  <p>Later I realized that this should also give me <code>1</code> as output for every <code>n</code>,  so I thought I could just add this before <code>return 0</code>: </p>
  
  <pre><code>if(k=1) printf("1"); 
  </code></pre>
  
  <p>But this doesn't seem very nice...How can I write this program more intelligently? </p>