Pneumonia is one of the deadliest infectious diseases worldwide, particularly affecting children under five years old and the elderly, with a significant mortality rate annually. This disease is caused by bacterial, viral, or fungal infections, leading to inflammation in the air sacs (alveoli) of the lungs, which disrupts respiratory function. A major challenge in diagnosing pneumonia lies in the reliance on radiological expertise to interpret chest X-ray images, a process that is time-consuming and prone to errors in interpretation. This study aims to compare the performance of deep learning models, specifically the combination of Convolutional Neural Networks (CNN) with Long Short-Term Memory (LSTM) and CNN with Feedforward Neural Networks (FNN), in classifying pneumonia based on chest X-ray images. The results indicate that the CNN & LSTM model achieved an accuracy of 96.59%, a loss of 9.95%, precision of 96%, recall of 95%, and F1-score of 96%, slightly outperforming the CNN & FNN model, which achieved an accuracy of 96.13%, a loss of 12.16%, precision of 96%, recall of 94%, and F1-score of 95%. The advantage of CNN & LSTM lies in its ability to capture sequential patterns through LSTM, making it more effective in detecting positive pneumonia cases. In conclusion, the CNN & LSTM model outperforms the CNN & FNN model in accuracy, recall, and F1-score, making it a more reliable choice for automatic pneumonia classification. The findings suggest the potential use of deep learning models, particularly CNN & LSTM, to support medical professionals and the public in quickly and accurately detecting pneumonia through chest X-ray images analysis