Program to find the product of a number with a Mersenne Number

Program to find the product of a number with a Mersenne Number
Given an integer N and a Mersenne number M, the task is to print their product without using the ‘*’ operator.Note: Mersenne numbers are those numbers which are one less than a power of two.
Examples:

Input: N = 4, M = 15Output: 60
Input: N = 9, M = 31Output: 279

Approach: The given problem can be solved based on the following observations: 

Suppose M can be represented as 2X – 1, then the product of N with M can be represented as N · 2X – N.
Therefore, product of any Mersenne number with any number N can be represented as (N