IHYPRESS PROGRAMMING
Tutorials and C programs with code and output for beginners
c programming
HOME | ASP | C | CSS | GNUPLOT | HTML | JAVASCRIPT | PERL | PHP | PYTHON | RUBY | SVG
CBitwise Operators & Binary Files : Right Shift Operator
<11.02>
/* The right shift bitwise operator */ #include <stdio.h> int main (void) { unsigned a=64, b=25, c=1, d=100; printf ("%4d >> 1 = %4d (%03x HEX)\n", a, a>>1, a>>1); printf ("%4d >> 1 = %4d (%03x HEX)\n", b, b>>1, b>>1); printf ("%4d >> 1 = %4d (%03x HEX)\n", c, c>>1, c>>1); printf ("%4d >> 1 = %4d (%03x HEX)\n", d, d>>1, d>>1); printf ("%4d >> 2 = %4d (%03x HEX)\n", a, a>>2, a>>2); printf ("%4d >> 3 = %4d (%03x HEX)\n", b, b>>3, b>>3); printf ("%4d >> 4 = %4d (%03x HEX)\n", d, d>>4, d>>4); printf ("%4d >> 5 = %4d (%03x HEX)\n", d, d>>5, d>>5); return(0); }
Hergestellt in Deutschland / Made in Germany
64 >> 1 = 32 ( 20 HEX) 25 >> 1 = 12 ( c HEX) 1 >> 1 = 0 ( 0 HEX) 100 >> 1 = 50 ( 32 HEX) 64 >> 2 = 16 ( 10 HEX) 25 >> 3 = 3 ( 3 HEX) 100 >> 4 = 6 ( 6 HEX) 100 >> 5 = 3 ( 3 HEX)
COPYRIGHT © 2015-2024 IHY PRESS Frankfurt am Main 60329 Deutschland