A Simple Program In C To Simulate Nuclear Fusion

 #include <stdio.h>

#include <math.h> // Function to calculate the energy released in a nuclear fusion reaction float energyReleased(int mass1, int mass2) { // Calculate the combined mass of both nuclei using E=mc^2 formula float combinedMass = (mass1 + mass2); // Calculate the amount of energy released by subtracting their difference from their combined masses and multiplying it with 9e16 Joules/Kg as per E=mc^2 formula return ((combinedMass - fabs(mass1 - mass2)) * 9e16); } // Driver code int main() { // Initialize the two masses of nuclei int mass1 = 1, mass2 = 1; printf("The energy released in a nuclear fusion reaction is %f Joules ", energyReleased(mass1, mass2)); return 0; }

Comments

Popular posts from this blog

Nuclear Fusion In Popular Culture

The Mathematics Of Nuclear Fusion