This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Autor : Código Root </> | |
* Mi blog: https://codigoroot.net/blog | |
*/ | |
public class tabla_dowhile { | |
public static void main (String [] args){ | |
int multiplicando = 5 ; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function calcularAreaTriangulo($base, $altura){ | |
$area = ($base * $altura) / 2 ; | |
return $area; | |
} | |
echo "El área del triangulo es: " . calcularAreaTriangulo(6,10); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
# Definir el valor del radio | |
$radio = 5; | |
# Elevamos radio al cuadrado con la función pow() | |
$radio_al_cuadrado = pow($radio, 2); | |
# La formula para calcular el área del circulo es PI * Radio ² | |
$area = pi() * $radio_al_cuadrado; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static double calcularPromedio(double[] valores) { | |
double suma = calcularSuma(valores); | |
double promedio = suma / valores.length; | |
return promedio; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static double calcularSuma(double[] valores) { | |
double suma = 0.0; | |
for (int i = 0; i < valores.length; i++) { | |
suma += valores[i]; | |
} | |
return suma; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
# La expresion se evalua en su valor booleano | |
# Si la expresion es verdadera se ejecuta la sentencia entre llaves, de lo contrario se omite la sentencia | |
if (expresion) { | |
sentencia // La sentencia sera ejecutada si la expresion es verdadera | |
} | |
?> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
date_default_timezone_set('America/Mexico_City'); | |
$fecha_actual = getdate(); | |
echo "Día: " . $fecha_actual['mday'] . "<br>"; | |
echo "Mes: " . $fecha_actual['mon'] . "<br>"; | |
echo "Año: " . $fecha_actual['year'] . "<br>"; | |
echo "Hora: " . $fecha_actual['hours'] . ":" . $fecha_actual['minutes'] . ":" . $fecha_actual['seconds']; | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
date_default_timezone_set('America/Mexico_City'); | |
$tiempo_en_segundos = time(); | |
$fecha_actual = date("d-m-Y h:i:s", $tiempo_en_segundos); | |
echo "La fecha actual es: $fecha_actual"; | |
# El resultado es: La fecha actual es: 11-02-2023 07:15:33 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
date_default_timezone_set('America/Mexico_City'); | |
$fechaActual = date("d-m-Y"); | |
$horaActual = date("h:i:s"); | |
echo "La fecha es: $fechaActual y la hora es $horaActual " ; | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$numero1 = 19; | |
$numero2 = 19; | |
if ($numero1 < $numero2) { | |
echo "La variable numero1 es menor que la variable numero2"; |