IHYPRESS.NET
C
HOME | ASP | C | CSS | HTML | JAVASCRIPT | PERL | PHP | PYTHON | RUBY | SVG
Earn Free Bitcoin
CData Types & Operators ❯ Integer Division & Type Casting
<02.02>
/* Integer division */
#include <stdio.h> int main (void) { int a, b, c; double x, y, z, w; a = 10; b = 20; /* dividing two integers */ z = a / b; c = a / b; printf ("The value of z is %5.3lf ", z); printf ("and the value of c is %d\n", c); /* converting (casting) one operand before the division*/ x = (double)a / b; printf ("The value of x is %5.3lf\n", x); /* casting the quotient after the division*/ y = (double) (a / b); printf ("The value of y is %5.3lf\n", y); /* casting both operands before the division*/ w = (double)a / (double)b; printf ("The value of w is %5.3lf\n", w); return (0); }
Hergestellt in Deutschland / Made in Germany
The value of z is 0.000 and the value of c is 0 The value of x is 0.500 The value of y is 0.000 The value of w is 0.500
COPYRIGHT © 2015-2024 IHYPRESS.NET. A DIVISION OF IHY PRESS. ALL RIGHTS RESERVED.