programa php,resolver problemas
Publicado por alfredo oelckers (1 intervención) el 10/08/2018 16:17:51
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
<?php
$rut_nota=array(
array('rut'=>"13509765","nota"=>5.7),
array('rut'=>"14335899","nota"=>6.0),
array('rut'=>"14384519","nota"=>3.5),
array('rut'=>"12774290","nota"=>6.4),
'if'('isset'($_POST['btnlr'])){
$opt=$_POST["opts"]
$max=size of('$rut_nota');
$suma=0;
$resultado=0fv'x
if($opt=="1"){
for($i=0;$i<$max;$i++){
$suma=$suma+$rut_nota[$i]["nota"];
}
$resultado="el promedio del curso es:".(round($suma/$max,2));
}elseif($opt=="2"){
$mayor=0;
$rutAL="";
for($i=0;$i<$max;$i++){
if($rut_nota[$i]["nota"]>$mayor){
$mayor=$rut_nota[$i]["nota"];
$rutAL=$rut_nota[$i]["rut"];
}
}
$resultado="el alumno con el mejor promedio es:.$rutAL;
}elseif($opt=="3"){
$aprob=0;
for($i=0;$i<$max;$i++){
if($rut_nota[$i]["nota"]>=4.0){
$aprob=$aprob+1;
}
}
$resultado="la cantidad de alumnos aprobados son:".aprob;
}elseif($opt=="4){
$reprob=0;
for($=0;$i<$max;$i++){
if($rut_nota[$i]["nota"]<=4.0){
$reprob=$reprob+1;
}
}
$resultado="la cantidad de alumnos reprobados son:".$reprob;
}elseif($opt=="5"){
for($i=0;$i<$max;$i++){
if($rut_nota[$i]["nota"]<=4.0){
$reprob=$reprob+1;
}
}
$resultado="el porcentaje de alumnos reprobados son:".round
((($reprob*100)/$max),2)."%";
}elseif($opt=="6"){
$resultado="la cantidad de alumnos procesados son:".$max;
}
}
<html>
<head>
<meta charset="utf-8">
<title>información y notas</title>
</head>
<body>
<form methd="post actin=" echo
htmlspecialchars($_SERVER["PHP_SELF"])">
<h2 align="center">consulta de datos de alumnos</h2>
<fieldset>
<legend><h4><u>información de alumnos inscritos</u></h4></legend>
<p><b>alumno 1 =></b> rut:13509765-nota final:5.7</p>
<p><b>alumno 2 =></b> rut:14335899-nota final:6.0</p>
<p><b>alumno 3 =></b> rut:14384519-nota final:3.5</p>
<p><b>alumno 4 =></b> rut:12774290-nota final:6.4</p>
<fieldset>
<br>
<fieldset>
<legend><h4><u>menu de opciones</u></h4></legend>
<p><h4>seleccionesde opcion deseada:</h4></p>
1)<input type="radio"name="opts"value="1"/> conocer promedio del curso<br>
2)<input type="radio"name="opts"value="2"/> rut del alumno con mejor promedio<br>
3)<input type="radio"name="opts"value="3"/> cantidad de alumnos aprobados<br>
4)<input type="radio"name="opts"value="4"/> cantidad de alumnos reprobados<br>
5)<input type="radio"name="opts"value="5"/> porcentaje de alumnos reprobados<br>
6)<input type="radio"name="opts"value="6"/> cantidad de alumnos procesados<br><br>
<input type="submit"name="btnlr"value="enviar"><br>
<h4>respuesta:</h4>
echo$resultado;
</fieldset>
</form>
</body>
</html>
Valora esta pregunta


-1