Documentos de Académico
Documentos de Profesional
Documentos de Cultura
Elaborar un programa que permita realizar un cálculo de la velocidad y tiempo de caída libre
de un objeto
3) Algoritmo lineal
Caída libre
1) Asignar la constante g , v g=9.81 g=9.81
2) Leer la altura h, h
3) Leer la velocidad inicial Vo , Vo
4) Calcular la velocidad final V f , V f ← √ V o2 +2 g∗h
Vf −Vo
5) Calcular el tiempo t ,t ←
g
6) Mostrar velocidad final,V f
7) Mostrar el tiempo,t
8) Fin
4) Diagrama de flujo
inicio
g=9.81
Vo
x
x
Vf ← √ V o2x+2 g∗h
Vf −Vo
t←
g
Vf ,t
Fin
5) Codificacion en JavaScript
<html>
<head>
<title></title>
<script language="javascript" type="text/javascript">
function calcular()
{
var vo=document.getElementById("Velinicial").value;
var h=document.getElementById("altura").value;
var vf= Math.sqrt(Math.pow(vo,2)+2*(9.81)*h)
document.getElementById("Velfinal").value=vf;
var t=(vf-vo)/9.81
document.getElementById("tiempo").value=t;
}
</script>
</head>
<body>
<b> Introduzca catetos:</b>
<b>Velocidad inicial :</b> <input type="text" name="Velocidad_Inicial"
id="Velinicial" value=0> <br>
<b>Altura:</b> <input type="text" name="Altura" id="altura" value=0>
<br>
<input type="button" value="calcular" name="calc" id="calc"
onclick="calcular()"> <br>
<hr>
<b>La velocidad final es:</b><input tupe="text" name="Velocidad_Final"
id="Velfinal"> <br>
<b>El tiempo es:</b> <input type="text" name="Tiempo" id="tiempo">
<br>
</body>
</html>