Fossil fuels are depleting as the need for energy has increased. Hence there is an urgent need to switch to…