Lee tres números y imprime de mayor y viceversa - PSeInt.Site

 

 

 

 

DESARROLLAMOS TUS ALGORITMOS (+51) 988411115

Muestra números de mayor a menor y viceversa

09. Programa un algoritmo que lea tres números y los imprima de mayor a menor y de menor a mayor.

¿EN QUE PROGRAMA QUIERES VER EL CÓDIGO? :

Curso de autocad, google colaboratory, curso de C, certificacion google, curso marketing digital, cisco python, páginas Web.

  Lenguaje C

  C++

  C#

  Python

  Java NetBeans

ANÁLISIS :

Lo primero seria ordenar por descarte: Trucos y guías de videojuegos

Por ejemplo: Si N1 > N2 y N1 > N3, sabemos que N1 es el mayor, por lo tanto faltaría preguntar si N2 > N3, si se da el caso que N2 es mayor que N3 fácil mente se sabe que : N1 es mayor, N2 es intermedio y N3 es el menor y se imprimen en ese orden.

Diagrama de flujo(DFD) para mostrar de mayor a menor y de menor a mayor:

DFD 1.0 DESCARGA CÓDIGO

VER CÓDIGO

PSeInt - FLEXIBLE DESCARGA CÓDIGO

Algoritmo Condicional09 Escribir "Ingrese Número 01 : " Leer N1 Escribir "Ingrese Número 02 : " Leer N2 Escribir "Ingrese Número 03 : " Leer N3 Si (N1 > N2) Y (N1 > N3) Entonces P = N1 Si N2 > N3 Entonces S = N2 T = N3 SiNo S = N3 T = N2 Fin Si SiNo Si N2 > N3 Entonces P = N2 Si N1 > N3 Entonces S = N1 T = N3 SiNo S = N3 T = N1 Fin Si SiNo P = N3 Si N1 > N2 Entonces S = N1 T = N2 SiNo S = N2 T = N1 Fin Si Fin Si Fin Si Escribir "Descendente : ", P " - " S " - " T Escribir "Ascendente : ", T " - " S " - " PFinAlgoritmo

PSeInt - ESTRICTO DESCARGA CÓDIGO

Algoritmo Condicional09 Definir N1, N2, N3, S, T, P como Entero; Escribir "Ingrese Número 01 : "; Leer N1; Escribir "Ingrese Número 02 : "; Leer N2; Escribir "Ingrese Número 03 : "; Leer N3; Si (N1 > N2) Y (N1 > N3) Entonces P N3 Entonces S n3)) { p = n1; if (n2>n3) { s = n2; t = n3; } else { s = n3; t = n2; } } else { if (n2>n3) { p = n2; if (n1>n3) { s = n1; t = n3; } else { s = n3; t = n1; } } else { p = n3; if (n1>n2) { s = n1; t = n2; } else { s = n2; t = n1; } } } cout xn3){ s = xn2; t = xn3; }else{ s = xn3; t = xn2; } }else{ if(xn2 > xn3){ p = xn2; if(xn1 > xn3){ s = xn1; t = xn3; }else{ s = xn3; t = xn1; } }else{ p = xn3; if(xn1 > xn2){ s = xn1; t = xn2; }else{ s = xn2; t = xn1; } } } document.getElementById('result1').value=p + " , " + s + " , " + t; document.getElementById('result2').value=t + " , " + s + " , " + p; }]]> INGRESE NUMERO 01 :

INGRESE NUMERO 02 :

INGRESE NUMERO 03 :

DESCENDENTE:

ASCENDENTE:

Visual Basic .Net - Consola DESCARGA CÓDIGO

Imports System.ConsoleModule Module9 Dim N1, N2, N3, P, S, T As Integer Sub Main() Write("Igrese Número 1 : ") N1 = ReadLine() Write("Igrese Número 2 : ") N2 = ReadLine() Write("Igrese Número 3 : ") N3 = ReadLine() If ((N1 > N2) And (N1 > N3)) Then P = N1 If (N2 > N3) Then S = N2 T = N3 Else S = N3 T = N2 End If Else If (N2 > N3) Then P = N2 If (N1 > N3) Then S = N1 T = N3 Else S = N3 T = N1 End If Else P = N3 If (N1 > N2) Then S = N1 T = N2 Else S = N2 T = N1 End If End If End If WriteLine("Descendente : " & P & " " & S & " " & T) WriteLine("Ascendente : " & T & " " & S & " " & P) ReadLine() End SubEnd Module

Lee tres números y imprime de mayor y viceversa - PSeInt.Site

Lee tres números y imprime de mayor y viceversa - PSeInt.Site

ANÁLISIS : Diagrama de flujo(DFD) para mostrar de mayor a menor y de menor a mayor: PSeInt - FLEXIBLE DESCARGA CÓDIGO PSeInt - ESTRICTO DESCARGA CÓDIGO Visu

programar

es

https://aprendeprogramando.es/static/images/programar-lee-tres-numeros-y-imprime-de-mayor-y-viceversa-pseint-664-0.jpg

2025-01-13

 

Lee tres números y imprime de mayor y viceversa - PSeInt.Site
Lee tres números y imprime de mayor y viceversa - PSeInt.Site

MÁS INFORMACIÓN

El contenido original se encuentra en /condicional/ordena-de-mayor-a-menor-y-viceversa/
Todos los derechos reservados para el autor del contenido original (en el enlace de la linea superior)
Si crees que alguno de los contenidos (texto, imagenes o multimedia) en esta página infringe tus derechos relativos a propiedad intelectual, marcas registradas o cualquier otro de tus derechos, por favor ponte en contacto con nosotros en el mail [email protected] y retiraremos este contenido inmediatamente

 

 

Update cookies preferences