-
Lenguaje
JavaScript
-
Descripción
Se desea calcular la potencia eléctrica de circuito de la figura que se muestra a continuación. Considere que: P = V*I y V = R*I
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "https://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Potencia de un circuito</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script>
<html>
<head>
<title>Potencia de un circuito</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script>
function algoritmo()
{
let corriente_en_amperios, potencia_en_watts, resistencia_en_omhs, voltaje;
corriente_en_amperios = parseFloat (document.formulario1.corriente_en_amperios.value);
resistencia_en_omhs=4;
voltaje=resistencia_en_omhs*corriente_en_amperios;
potencia_en_watts=voltaje*corriente_en_amperios;
document.formulario1.potencia_en_watts.value = potencia_en_watts;
document.formulario1.resistencia_en_omhs.value = resistencia_en_omhs;
document.formulario1.voltaje.value = voltaje;
}
{
let corriente_en_amperios, potencia_en_watts, resistencia_en_omhs, voltaje;
corriente_en_amperios = parseFloat (document.formulario1.corriente_en_amperios.value);
resistencia_en_omhs=4;
voltaje=resistencia_en_omhs*corriente_en_amperios;
potencia_en_watts=voltaje*corriente_en_amperios;
document.formulario1.potencia_en_watts.value = potencia_en_watts;
document.formulario1.resistencia_en_omhs.value = resistencia_en_omhs;
document.formulario1.voltaje.value = voltaje;
}
</script>
</head>
<body>
<form name="formulario1">
<table style="text-align: left; margin-left: auto; margin-right: auto;">
<tbody>
<tr>
<td>
<label for="corriente_en_amperios">Ingresa el valor de corriente en amperios:</label>
</td>
<td>
<input name="corriente_en_amperios" required="required" step="0.000001" type="number" />
</td>
</tr>
<tr align="center">
<td colspan="2" rowspan="1">
<input value="Procesar" type="button" onclick="algoritmo();" />
<input type="reset" />
</td>
</tr>
<tr>
<td>
<label for="potencia_en_watts">Valor de potencia en watts:</label>
</td>
<td>
<input name="potencia_en_watts" step="0.000001" type="number" />
</td>
</tr>
<tr>
<td>
<label for="resistencia_en_omhs">Valor de resistencia en omhs:</label>
</td>
<td>
<input name="resistencia_en_omhs" step="0.000001" type="number" />
</td>
</tr>
<tr>
<td>
<label for="voltaje">Valor de voltaje:</label>
</td>
<td>
<input name="voltaje" step="0.000001" type="number" />
</td>
</tr>
</tbody>
</table>
</form>
</body>
</html>
</head>
<body>
<form name="formulario1">
<table style="text-align: left; margin-left: auto; margin-right: auto;">
<tbody>
<tr>
<td>
<label for="corriente_en_amperios">Ingresa el valor de corriente en amperios:</label>
</td>
<td>
<input name="corriente_en_amperios" required="required" step="0.000001" type="number" />
</td>
</tr>
<tr align="center">
<td colspan="2" rowspan="1">
<input value="Procesar" type="button" onclick="algoritmo();" />
<input type="reset" />
</td>
</tr>
<tr>
<td>
<label for="potencia_en_watts">Valor de potencia en watts:</label>
</td>
<td>
<input name="potencia_en_watts" step="0.000001" type="number" />
</td>
</tr>
<tr>
<td>
<label for="resistencia_en_omhs">Valor de resistencia en omhs:</label>
</td>
<td>
<input name="resistencia_en_omhs" step="0.000001" type="number" />
</td>
</tr>
<tr>
<td>
<label for="voltaje">Valor de voltaje:</label>
</td>
<td>
<input name="voltaje" step="0.000001" type="number" />
</td>
</tr>
</tbody>
</table>
</form>
</body>
</html>