ALGORITMO QUE MUESTRA SI ES DE DIA, TARDE, NOCHE O MADRUGADA

Categoría de Estructura Condicional Anidada


CÓDIGO QUE MUESTRA SI DE DÍA, TARDE O NOCHE.

💻 Hacer un programa donde se ingrese una hora determinada desde 1h a 24h y muestre si es de día de [6 hr a 12 hr], tarde desde [13 hr a 18 hr], noche de [19 hr a 24 hr] y madrugada de [1 hr a 5 hr].


Algoritmo en pseint que muestre dia, tarde o noche PSeInt Estricto : DESCARGA EL CÓDIGO

algoritmo que muestre dia, tarde o noche

Algoritmo en pseint - short youtube
Algoritmo programacion_work
    // Muestra si es de día, tarde o noche.
    
    Definir hora como Entero;	
    Escribir "INGRESE UNA HORA [1 - 24] : ";
    Leer hora;	
    SI (hora >= 6 y hora <= 12) Entonces
        Escribir "ES DE DÍA";
    SiNo
        SI (hora >= 13 y hora <= 18) Entonces
            Escribir "ES DE TARDE";
        SiNo
            SI (hora >= 19 y hora <= 24) Entonces
                Escribir "ES DE NOCHE";
            SiNo
                Escribir "ES DE MADRUGADA";
            FinSi
        FinSi
    FinSi
    
FinAlgoritmo
Algoritmo en pseint que muestre dia, tarde o noche

código en python que muestra si es de dia, tarde, noche o madrugada Python :

print("MOSTRAR SI ES DE DÍA, TARDE, NOCHE O MADRUGADA")
hora = int(input("INGRESE UNA HORA [1 - 24] : "))
if hora >= 6 and hora <= 12:
    print("ES DE DIA")
elif hora >= 13 and hora <= 18:
    print("ES DE TARDE")
elif hora >= 19 and hora <= 24:
    print("ES DE NOCHE")
else:
    print("ES DE MADRUGADA")

código en Lenguaje C que muestra número positivo, negativo o nulo Lenguaje C :

#include<stdio.h>
int main() {
    int hora;
    printf("04. MOSTRAR SI ES DE DIA, TARDE, NOCHE O MADRUGADA.\n\n");    
    printf("INGRESE UNA HORA [1 - 24] : ");    
    scanf("%d",&hora); 
    if(hora >= 6 && hora <= 12){
        printf("\nES DE DIA");
    }else{
        if(hora >= 13 && hora <= 18){
            printf("\nES DE TARDE");
        }else{
            if(hora >= 19 && hora <= 24){
                printf("\nES DE NOCHE");
            }else{
                printf("\nES DE MADRUGADA");
            }
        }
    }        
    return 0;
}

código en Dev C++ que indique si es de dia, tarde, noche y madrugada Dev C++ :

#include<iostream>
using namespace std;
int main() {
    int hora;
    cout << "04. MOSTRAR SI ES DE DIA, TARDE, NOCHE O MADRUGADA." << endl;
    cout << "INGRESE UNA HORA [1 - 24] : ";
    cin >> hora;		
    if(hora >= 6 && hora <= 12){
        cout << "ES DE DIA" << endl;	
    }else{
        if(hora >= 13 && hora <= 18){
            cout << "ES DE TARDE" << endl;	
        }else{			
            if(hora >= 19 && hora <= 24){
                cout << "ES DE NOCHE" << endl;	
            }else{			
                cout << "ES DE MADRUGADA" << endl;				
            }			
        }	
    }
    return 0;
}

Programar en Java NetBeans para mostrar si es de dia, tarde, noche o de madrugada Java NetBeans :

package programacion_work;
import java.util.Scanner;
public class dia_tarde_noche_madrugada {
    public static void main(String[] args) {        
        int hora;      
        Scanner ingreso=new Scanner(System.in);
        System.out.print("INGRESE UNA HORA [1 - 24] : ");
        hora = Integer.parseInt(ingreso.next());
        if(hora >= 6 && hora <= 12){
            System.out.println("ES DE DIA");	
        }else{
            if(hora >= 13 && hora <= 18){
                System.out.println("ES DE TARDE");	
            }else{
                if(hora >= 19 && hora <= 24){
                    System.out.println("ES DE NOCHE");	
                }else{
                    System.out.println("ES DE MADRUGADA");
                }
            }	
        }	
    }        
}



Facebook de www.programacion.work. Canal de Youtube de www.programacion.work. Twitter de www.programacion.work. TikTok de www.programacion.work.


Política de cookies

Política de Privacidad

Aviso Legal y Términos De Uso