1 2 3 4 5 6 7 8
v1=9; v2=12; i=100*10^(-3); v=v2-v1; r=v/i; disp("the value of the resistor (in Ω) is"); disp(r); p=v*i; disp("power rating (in W) of the required resistor is"); disp(p);