U A C M

¿Quieres reaccionar a este mensaje? Regístrate en el foro con unos pocos clics o inicia sesión para continuar.
U A C M

Universidad Autónoma de la Ciudad de México


    PROGRAMA QUE MUESTRA LA HORA ACTUAL

    Krlos
    Krlos
    Admin


    Mensajes : 72
    Fecha de inscripción : 11/05/2011

    PROGRAMA QUE MUESTRA LA HORA ACTUAL Empty PROGRAMA QUE MUESTRA LA HORA ACTUAL

    Mensaje  Krlos Vie Mayo 20, 2011 4:11 pm

    /* PROGRAMA QUE MUESTRA LA HORA ACTUAL
    Y CALCUA EL TIEMPO RESTANTE PARA CULMINAR EL DIA
    AUTOR: CARLOS E. LÓPEZ */

    #include <stdio.h>
    #include <conio.h>
    main()
    {
    int hrs=0;
    int min=0;
    int seg=0;
    printf("\nPROGRAMA QUE MUESTRA LA HORA ACTUAL DEL DIA Y CALCULA EL TIEMPO QUE RESTA\n\n\n" );
    printf("Digite la HORA actual: ");
    scanf("%d",&hrs);
    printf("Introduzca los MINUTOS: ");
    scanf("%d",&min);
    printf("Introduzca los SEGUNDOS: ");
    scanf("%d",&seg);
    if(hrs>24)
    {
    printf("\n\nLA HORA REGISTRADA ES INCORRECTA\n\n\n\n");
    system("PAUSE");
    return 0;
    }
    if(hrs==24&&min!=0||hrs==23&&min>59)
    {
    printf("\n\nLA HORA REGISTRADA ES INCORRECTA\n\n\n\n");
    system("PAUSE");
    return 0;
    }
    if(hrs==24&&min==0&&seg==0)
    {
    printf("\n\n\nHORA ACTUAL: \n\n%d : %d : %d ",hrs,min,seg);
    printf("\n\n\nY RESTA PARA TERMINAR EL DIA: \n\n0 HORAS con 0 MINUTOS y 0 SEGUNDOS\n\n\n\n",hrs,min,seg);
    }
    else
    {
    printf("\n\n\nHORA ACTUAL: \n\n%d : %d : %d ",hrs,min,seg);
    hrs=23-hrs;
    min=59-min;
    seg=60-seg;
    printf("\n\n\nY RESTA PARA TERMINAR EL DIA: \n\n%d HORAS con %d MINUTOS y %d SEGUNDOS\n\n\n\n",hrs,min,seg);
    }
    system("PAUSE");
    return 0;
    getch();
    }

      Fecha y hora actual: Dom Mayo 19, 2024 6:28 am