Resource pricing in cloud computing has become one of the main challenges for cloud providers. The challenge is determining a fair and appropriate price to satisfy users and resource providers. To establish a justifiable price, it is imperative to take into account the circumstances and requirements of both the provider and the user. This research tries to provide a pricing mechanism for cloud computing based on game theory. The suggested approach considers three aspects: the likelihood of faults, the interplay among virtual machines, and the amount of energy used, in order to determine a justifiable price. In the game that is being proposed, the provider is responsible for determining the price of the virtual machine that can be made available to the user on each physical machine. The user, on the other hand, has the authority to choose between the virtual machines that are offered in order to run their application. The whole game is implemented as a function of the resource broker component. The proposed mechanism is simulated and evaluated using the CloudSim simulator. Its performance is compared with several previous recent mechanisms. The results indicate that the suggested mechanism has successfully identified a more rational price for both the user and the provider, consequently enhancing the overall profitability of the cloud system.