title: I tried write a program for finding GCD using a function.Why is this code not working?
body: <p>This is the code i have written so far, i can't find any logical redundancies . Please help.</p>
  <pre><code>#include&lt;stdio.h&gt;   
  
  int gcd(int,int);  
  void main()
  
  {
  int a, b, c;
  printf(&quot;enter 2 num\n&quot; );
  scanf(&quot;%d%d&quot;,&amp;a,&amp;b);  
  printf(&quot;gcd of %d and %d is %d&quot;,a,b,gcd(a,b));
  }
  
  int gcd(int a,int b)  
  {
  int i, c;
  for(i=0;i&lt;a&amp;&amp;i&lt;b;i++)
  {
      if((a%i==0)&amp;&amp;(b%i==0))
          
      c=i;
      
  }
  return c;
  
  }
  </code></pre>
  <p>I am not getting any output.
  Input: 25, 75</p>
  <p>ps. my first question</p>
  <p>edit: thanks for the help , i did a silly mistake and intialized i=0, so my program crashed .</p>