bsc

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

root / semester_1 / letusc / luc084.c

luc084.c (1008B)


      1 /* Define a function that compares two given dates. Return 0 if equal, otherwise return 1.
      2 */
      3 /* Let Us C, Chap- 17 (Structures), Qn No.: B(g) */
      4 
      5 /* This file is auto-generated by a bot. */
      6 /* This code is not compiled; it is for reference only. */
      7 
      8 
      9 #include <stdio.h>
     10 #include <string.h>
     11 #include <stdlib.h>
     12 
     13 struct date
     14 {
     15     int day;
     16     int month;
     17     int year;
     18 };
     19 
     20 int compare_dates(struct date d1, struct date d2);
     21 
     22 int main()
     23 {
     24     struct date date1, date2;
     25 
     26     printf("Enter Date 1 (dd mm yyyy): ");
     27     scanf("%d %d %d", &date1.day, &date1.month, &date1.year);
     28 
     29     printf("Enter Date 2 (dd mm yyyy): ");
     30     scanf("%d %d %d", &date2.day, &date2.month, &date2.year);
     31 
     32     if (compare_dates(date1, date2) == 0)
     33         printf("The dates are Equal.\n");
     34     else
     35         printf("The dates are NOT Equal.\n");
     36 
     37     return 0;
     38 }
     39 
     40 int compare_dates(struct date d1, struct date d2)
     41 {
     42     if (d1.day == d2.day && d1.month == d2.month && d1.year == d2.year)
     43         return 0;
     44     else
     45         return 1;
     46 }
© notamitgamer • Site Built: 2026-09-05 01:53:16 UTC • git-mirror commit: c170d72 [view raw info]
Originally created with stagit • modified by notamitgamer
Forked from github.com/notamitgamer/git-mirror