diff --git a/Efficient way to multiply with 7 b/Efficient way to multiply with 7 new file mode 100644 index 0000000..03bffb1 --- /dev/null +++ b/Efficient way to multiply with 7 @@ -0,0 +1,21 @@ +# include + +using namespace std; +//c++ implementation +long multiplyBySeven(long n) +{ + /* Note the inner bracket here. This is needed + because precedence of '-' operator is higher + than '<<' */ + return ((n<<3) - n); +} + +/* Driver program to test above function */ +int main() +{ + long n = 4; + + cout<