home *** CD-ROM | disk | FTP | other *** search
/ DP Tool Club 17 / CD_ASCQ_17_101194.iso / dos / prg / alb_c10 / chap_02 / ch02_08.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-09-08  |  633 b   |  32 lines

  1. /*********************************************************************
  2. *  CH02_08.C             MΘlange de types dans une mΩme expression   *
  3. *********************************************************************/
  4.  
  5. #include<stdio.h>     
  6.  
  7. main( void)
  8. {
  9.     int a= 3, b= 4, c, d;
  10.     double t= 3.0, x, y;
  11.  
  12.     c= b/ a;
  13.  
  14.     x= b/ a;
  15.     y= b/ t;
  16.  
  17.     printf(" c= %d\t x= %lf\t y= %lf",c, x, y);
  18.  
  19.     x= 1.0* b/ a;
  20.         y= b/ a* 1.0;
  21.     printf("\n\n x= %lf\t y= %lf", x, y);
  22.  
  23.     d= 1.0* b/ a;
  24.     printf("\n\n d= %d", d);
  25. }
  26. /*
  27.  
  28.  c= 1    x= 1.000000    y= 1.333333
  29.  
  30.  x= 1.333333    y= 1.000000 ( y= 1 * 1.0 = 1.000000  )
  31.  
  32.  d= 1                                   */