Convert double to int : Double « Data Type « C / ANSI-C






Convert double to int

  
#include <stdio.h>

int main(void)
{
  int i;
  long double ld;

  ld = 10.0;
  i = ld; /*convert double to int*/

  printf("%d", i);
}


           
       








Related examples in the same category

1.A function to output double values in a given widthA function to output double values in a given width
2.Table of reciprocals, squares, cubes, and fourth powersTable of reciprocals, squares, cubes, and fourth powers
3.Calculating the area of a room
4.Calculating volume price of alternative productsCalculating volume price of alternative products
5.Calculating average hourly pay rateCalculating average hourly pay rate
6.Double calculation: square Double calculation: square