Pneumonia continues to be a prominent treatable cause of global mortality, stressing the importance of early identification to enable prompt intervention. Chest X-rays (CXRs) are an essential diagnostic tool, however determining their exact interpretation is still very difficult. By addressing both medical experts and individuals who are new to the area, the proposed work aims to improve prediction of pneumonia. The Synthetic Minority Over-sampling Technique has been utilised to cope with imbalanced dataset because the used dataset does not have balanced distribution among all classes. A pneumonia prediction model that makes use of convolutional neural networks including CustomVGG19, CustomResNet-50 and CustomDenseNet121 and the proposed ensemble model to improve diagnosis of pneumonia has been proposed. These models are trained and improved in experiments. The optimization of each model's performance was achieved through the systematic exploration of diverse configurations and hyperparameters. The ultimate outcomes were derived by employing the ensemble technique, which involved amalgamating the predictions of CNN models during the analysis. Results demonstrate the superiority of the proposed model, which achieved a 97.68% prediction accuracy.