title: Fraction reduction C program
body: <p>Alright Guys, SO this was an homework assignment, however It's been submitted and I received a 78 :. My professor has yet to respond to my email of help  So here I am now. </p>
  
  <p>The first part of the code is supposed to reduce fractions to their lowest form, and it works.. except when the greatest common denominator is above 10. This is an introduction to C class and I have very little to no experience with C and its specificities. Any help/guidance/ideas with the GCD issue..?</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  
  int main (void)
  {
  int num;
  int den;
  int x;
  int y;
  int i;
  int a;
  int n;
  int w;
  int j;
  
  printf("\n *************Question 1 *************** \n");
  printf("Please enter the numerator: ");
  scanf("%d", &amp;num);
  printf("Please enter the denominator: ");
  scanf("%d", &amp;den);
  printf("The fraction entered is: \n %d/%d \n", num, den );
  if (num &gt; den)
  x=den;
  else
      x=num;
  for(i=x; i&gt;=1; i--){
          if(num % i == 0 &amp;&amp; den % i == 0){
                          printf("This fraction can be reduced! \n");
                  num = num/i;
                  den = den/i;
                      printf("The reduced fraction is %d/%d \n \n", num, den); break;}
          else
              printf("This fraction cannot be reduced any further \n");
                  break;
  }
  printf("\n ***************Question 2****************** \n");
  printf("Please enter a number and I will print the even squares up to your input   ");
  scanf("%d", &amp;n);
  for ( w=1; w&lt;=n; w++)
          if (w*w%2 == 0 &amp;&amp; w*w &lt;= n )
  printf("%d \n", w*w);
  
  printf("Question 5 test... please enter 10.3 then 5 then 6 ");
  scanf("%d%f%d",&amp;i,&amp;x,&amp;j);
  printf("%d %f  %d \n",i,x,j);
  
  return 0;
  }
  </code></pre>