Skip to content
Exercises · Q20

Q.The formula E = mc² states that the equivalent energy (E) can be calculated as the mass (m) multiplied by the speed of light (c = about 3×10⁸ m/s) squared. Write a program that accepts the mass of an object and determines its energy.

Uttarakhand UbseTextbookSubjective· 3mImportance★★★★★est
96% · 47/49 Questions
🔒 Locked · start free trial →

You're viewing a preview — the full solution, concept, methods & PYQ mapping are locked.

Start your 14-day free trial to unlock the full solution →

energy = mass × c², with c = 3 × 10⁸ m/s written as 3 * 10**8 — a 5 kg mass gives 4.5e+17 joules, printed in scientific notation.

The concept is squaring with the exponent operator and handling very large numbers: Python computes them exactly (ints) or shows them in scientific notation (floats), so no special handling is needed for a number like 9 × 10¹⁶.

# E = m * c**2 : mass-energy equivalence
mass = float(input("Enter mass of the object in kg: "))
c = 3 * 10**8              # speed of light in m/s
energy = mass * c**2
print("Equivalent energy =", energy, "joules")

Key lines:

  • 3 * 10**8 — precedence: ** before *, so this is 3 × 10⁸ = 300000000. (Writing 3e8 is an equivalent float literal.)
  • c**2 = 9 × 10¹⁶; multiplying by the float mass makes the result a float, which Python prints in scientific notation once it is large.

Sample run (example values):

Enter mass of the object in kg: 5
Equivalent energy = 4.5e+17 joules

Working: c² = (3×10⁸)² = 9×10¹⁶; E = 5 × 9×10¹⁶ = 45×10¹⁶ = 4.5×10¹⁷ J — Python displays this as 4.5e+17. …

Unlock everything free for 14 days

  • Full step-by-step solutions
  • Concept-first explanations
  • Methods, shortcuts & mistakes
  • PYQ mapping + timed mock tests

Full access for 14 days. No credit card required.