the partition function of a system is given by z= 1/(1-e^-bEi), calculate the total energy of the system

#include <iostream>
#include <cmath>

double calculateTotalEnergy(double beta, double Ei) {
    return Ei / (1 - std::exp(-beta * Ei));
}

int main() {
    // Input parameters
    double beta, Ei;

    // Get input values
    std::cout << "Enter the value of beta: ";
    std::cin >> beta;

    std::cout << "Enter the value of Ei: ";
    std::cin >> Ei;

    // Calculate total energy using the partition function
    double totalEnergy = calculateTotalEnergy(beta, Ei);

    // Display the result
    std::cout << "Total Energy: " << totalEnergy << std::endl;

    return 0;
}