Different case and display value depend on case

float energy=0;
energy = (power/3600) + energy;

This is equivalent to "energy = power/3600;". If you want the value of energy to accumulate, you have to make 'energy' either static or global.

This version will accumulate energy:

static float energy=0;
energy = (power/3600) + energy;