title: To generate an integer output for a float variable in c
body: <p>Okay this is actually a very simple code but since I am only starting to learn C, please be patient and help me out. I'll be putting my Questions as comments beside the code so that it easy to relate to which part of the code I have a doubt. </p>
  
  <pre><code>#include &lt;stdio.h&gt;
  main()
  {
   int first_no, second_no;
   float dec_no, output_no;
   first_no = 75;
   second_no = first_no/2;
   dec_no = 35.3;
   output_no = dec_no/3;
   printf("First No:%d\n", first_no);
   printf("Second No:%d\n", second_no);
   printf("Third No:%d\n",output_no); 
   /*here I wanted to print only the integer part of the output_no */
  }
  </code></pre>
  
  <p>The problem with this is that I had a book and it displayed the value for third no as 0. </p>
  
  <p>And then in another program it says that compile time error is shown. </p>
  
  <p>Second program: </p>
  
  <pre><code>#include &lt;stdio.h&gt;
  void main()
  {
   int x = 5.3%2;
   printf("Value of x is %d", x);
  }
  </code></pre>
  
  <p>For this program, the book says that a compile time error will be shown. I fail to understand why that is the case. According to me the output should be 1. </p>
  
  <hr>
  
  <p>If I were to use the following code instead of the previous code: </p>
  
  <pre><code>#include &lt;stdio.h&gt;
  main()
  {
   int first_no, second_no;
   float dec_no, output_no;
   first_no = 75;
   second_no = first_no/2;
   dec_no = 35.3;
   output_no = dec_no/3;
   printf("First No:%d\n", first_no);
   printf("Second No:%d\n", second_no);
   printf("Third No:%d\n",dec_no); 
  }
  </code></pre>
  
  <p>What output should I expect? Do I still get a zero or some unpredictable output? </p>