Lesson 1 of 15

Ohm's Law

Ohm's Law

Ohm's Law is the most fundamental relationship in circuit analysis:

V = I · R

Where:

  • V = voltage across the resistor (volts, V)
  • I = current through the resistor (amperes, A)
  • R = resistance (ohms, Ω)

The Three Forms

Rearranging gives you the form you need:

I = V / R     (find current from voltage and resistance)
V = I · R     (find voltage from current and resistance)
R = V / I     (find resistance from voltage and current)

Physical Intuition

Think of a resistor as a pipe carrying water:

  • Voltage is the pressure pushing the water
  • Current is the flow rate
  • Resistance is how narrow the pipe is

Double the pressure (voltage) → double the flow (current). Double the pipe restriction (resistance) → half the flow.

Examples

Voltage (V)Resistance (Ω)Current (A)
12 V4 Ω3 A
5 V1000 Ω0.005 A (5 mA)
9 V3 Ω3 A
120 V60 Ω2 A

Your Task

Implement double ohms_law(double v, double r) that returns the current through a resistor given voltage v and resistance r.

TCC compiler loading...
Loading...
Click "Run" to execute your code.