Código
num1 = int (input("Ingrese un numero1: ")) num2 = int (input("Ingrese un numero2: ")) num3 = int (input("Ingrese un numero3: ")) num4 = int (input("Ingrese un numero4: ")) num5 = int (input("Ingrese un numero5: ")) ## r2 = abs(num1 - num2) r3 = abs(num1 - num3) r4 = abs(num1 - num4) r5 = abs(num1 - num5) menor = r2 cercano = num2 if r3 < menor: menor = r3 cercano = num3 print ("El mas cercano es: num3 y su valor ingresado es: ", num5) if r4 < menor: menor = r4 cercano = num4 print ("El mas cercano es: num 4 y su valor ingresado es: ", num4) if r5 < menor: menor = r5 cercano = num5 print ("El mas cercano es: num5 y su valor ingresado es: ", num5) if r2 == menor: print ("El mas cercano es: num2 y su valor ingresado es: ", num2)
Mod: Obligatorio el uso de etiquetas GeSHi para códigos.