C Program to Multiply given Number by 4 using Bitwise Operators

C Program to Multiply given Number by 4 using Bitwise Operators.

  1. #include <stdio.h>
  2.  
  3. void main()
  4. {
  5.     long number, tempnum;
  6.  
  7.     printf("Enter an integer \n");
  8.     scanf("%ld", &number);
  9.     tempnum = number;
  10.     /*  left shift by two bits */
  11.     number = number << 2;
  12.     printf("%ld x 4 = %ld\n", tempnum, number);
  13. }

 

Comments

Popular posts from this blog

C Program to Display the ATM Transaction

Java programming language

Python Program to Print all Prime Numbers in an Interval