A Simple Program In C To Simulate Nuclear Fusion
# include < std io . h > # include < math . h > // Function to calculate the energy released in a nuclear fusion reaction float energy Released ( int mass 1 , int mass 2 ) { // Calcul ate the combined mass of both nucle i using E = mc ^ 2 formula float combined Mass = ( mass 1 + mass 2 ); // Calcul ate the amount of energy released by subtract ing their difference from their combined masses and multiplying it with 9 e 16 Jou les / K g as per E = mc ^ 2 formula return (( comb ined Mass - fab s ( mass 1 - mass 2 )) * 9 e 16 ); } // Driver code int main () { // Initial ize the two masses of nucle i int mass 1 = 1 , mass 2 = 1 ; printf (" The energy released in a nuclear fusion reaction is % f Jou les ", energy Released ( mass 1 , mass 2 )); return 0 ; }