Created
August 7, 2019 23:49
-
-
Save parzibyte/f21ffa50da1d8acc74c9470d9bc90172 to your computer and use it in GitHub Desktop.
This file contains 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
#include <stdio.h> | |
int main(int argc, char const *argv[]) | |
{ | |
// Aquí almacenaremos los 3 números | |
int numeros[3]; | |
for (int i = 0; i < 3; ++i) | |
{ | |
printf("Por favor, ingresa el numero %d:\n", i + 1); // Sumar 1 porque empezamos desde 0 | |
scanf("%d", &numeros[i]); | |
} | |
//Suponemos que el menor es el primer número | |
int numeroMenor = numeros[0]; | |
// Comenzar desde el 1, porque estamos suponiendo que el 0 es el menor | |
for (int indice = 1; indice < 3; ++indice) | |
{ | |
int numeroActual = numeros[indice]; | |
if (numeroActual < numeroMenor){ | |
// Cambiar únicamente si el actual es menor que numeroMenor | |
numeroMenor = numeroActual; | |
} | |
} | |
printf("De los 3 numeros que proporcionaste, el menor es %d\n", numeroMenor); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment