-
Lenguaje
JavaScript
-
Descripción
Solicite al usuario el número de asistencias del estudiante y el número de clases dictadas e informe si aprobó el curso (siempre y cuando tenga más del 80% de sus asistencias); caso contrario presente un mensaje de reprobado.
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
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
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "https://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Porcentaje de asistencias</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script>
<html>
<head>
<title>Porcentaje de asistencias</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script>
function algoritmo()
{
let numero_de_asistencias, numero_de_clases, porcentaje;
numero_de_asistencias = parseFloat (document.formulario1.numero_de_asistencias.value);
numero_de_clases = parseFloat (document.formulario1.numero_de_clases.value);
porcentaje=100.0*numero_de_asistencias/numero_de_clases;
if(porcentaje>80)
alert('Aprobado');
else
alert('Reprobado');
document.formulario1.porcentaje.value = porcentaje;
}
{
let numero_de_asistencias, numero_de_clases, porcentaje;
numero_de_asistencias = parseFloat (document.formulario1.numero_de_asistencias.value);
numero_de_clases = parseFloat (document.formulario1.numero_de_clases.value);
porcentaje=100.0*numero_de_asistencias/numero_de_clases;
if(porcentaje>80)
alert('Aprobado');
else
alert('Reprobado');
document.formulario1.porcentaje.value = porcentaje;
}
</script>
</head>
<body>
<form name="formulario1">
<table style="text-align: left; margin-left: auto; margin-right: auto;">
<tbody>
<tr>
<td>
<label for="numero_de_asistencias">Ingresa el valor de numero de asistencias:</label>
</td>
<td>
<input name="numero_de_asistencias" required="required" step="0.000001" type="number" />
</td>
</tr>
<tr>
<td>
<label for="numero_de_clases">Ingresa el valor de numero de clases:</label>
</td>
<td>
<input name="numero_de_clases" 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="porcentaje">Valor de porcentaje:</label>
</td>
<td>
<input name="porcentaje" 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="numero_de_asistencias">Ingresa el valor de numero de asistencias:</label>
</td>
<td>
<input name="numero_de_asistencias" required="required" step="0.000001" type="number" />
</td>
</tr>
<tr>
<td>
<label for="numero_de_clases">Ingresa el valor de numero de clases:</label>
</td>
<td>
<input name="numero_de_clases" 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="porcentaje">Valor de porcentaje:</label>
</td>
<td>
<input name="porcentaje" step="0.000001" type="number" />
</td>
</tr>
</tbody>
</table>
</form>
</body>
</html>