Energy distribution of electrons producing microwave impulsive bursts and X-ray bursts from the sun