bsc

Comprehensive codebase and cou...
Log | Files | Refs | README | LICENSE

luc041.c (759B)


      1 /*
      2  * Author: Amit Dutta (amitdutta4255@gmail.com) | Date: 12 Dec 2025
      3  * Repo: https://github.com/notamitgamer/bsc
      4  * License: MIT
      5  */
      6 
      7 /* Write a program to print 24 hours of day with suitable suffixes like
      8 AM, PM, Noon and Midnight. */
      9 /* Let Us C, Chap- 6, Page - 106, Qn No.: B(h) */
     10 
     11 #include <stdio.h>
     12 int main()
     13 {
     14     int hour, temp;
     15     printf("Time \tSuffix\n");
     16     for (int hour = 0; hour <= 23; hour++)
     17     {
     18         if (hour == 0)
     19             printf("12:00\tAM (Midnight)\n");
     20         else if (hour == 12)
     21             printf("12:00\tPM (Noon)\n");
     22         else if (hour >= 1 && hour <= 11)
     23             printf("%02d:00\tAM\n", hour);
     24         else if (hour >= 13 && hour <= 23)
     25             printf("%02d:00\tPM\n", hour - 12);
     26     }
     27     return 0;
     28 }
© notamitgamer • Site Built: 2026-07-21 13:58:23 UTC • git-mirror commit: 1037f62 [view raw info]
Originally created with stagit • modified by notamitgamer
Forked from github.com/notamitgamer/git-mirror