title: C Program to find maximum and minimum between two numbers using functions
body: <p>I was solving a code of maximum and minimum using functions. I wrote the code like this:</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  
  int maxmin(int x, int y);
  
  int main () {
      int a, b, c;
  
      scanf("%d%d", &amp;a, &amp;b);
  
      c = maxmin(a, b);
  
      if (maxmin == 1) {
          printf("%d is maximum,%d is minimum", a, b);
      }
      else
          printf("%d is maximum,%d is minimum", b, a);
  
      return 0;    
  }
  
  int maxmin(int x, int y) {
      int XisMax = 0;
      if (x &gt; y) {
          XisMax=1;
      }
      else {
          XisMax=0;
      }
      return XisMax;
  }
  </code></pre>
  
  <p>So my output shows this results:</p>
  
  <pre><code>Input:9,10;
  10 is maximum,9 is minimum
  
  Input:10,9;
  9 is maximum,10 is minimum
  </code></pre>
  
  <p>What is the mistake here? What should I do?</p>
  
  <p>PS:I have an exam on functions so solutions using functions will be helpful.</p>