programming-examples/c/Basic/C Program to Multiply given Number by 4 using Bitwise Operators.c

15 lines
341 B
C
Raw Normal View History

2019-11-18 14:44:36 +01:00
/*
* C program to multiply given number by 4 using bitwise operators
*/
#include <stdio.h>
void main()
{
long number, tempnum;
printf("Enter an integer \n");
scanf("%ld", &number);
tempnum = number;
/* left shift by two bits */
number = number << 2;
printf("%ld x 4 = %ld\n", tempnum, number);
}