luc084.c (1199B)
1 /* 2 * Author : Amit Dutta <amitdutta4255@gmail.com> 3 * Date : 08 Feb 2026 4 * Repo : https://github.com/notamitgamer/bsc 5 * License : MIT License (See the LICENSE file for details) 6 */ 7 8 /* Define a function that compares two given dates. Return 0 if equal, otherwise return 1. 9 */ 10 /* Let Us C, Chap- 17 (Structures), Qn No.: B(g) */ 11 12 /* This file is auto-generated by a bot. */ 13 /* This code is not compiled; it is for reference only. */ 14 15 16 #include <stdio.h> 17 #include <string.h> 18 #include <stdlib.h> 19 20 struct date 21 { 22 int day; 23 int month; 24 int year; 25 }; 26 27 int compare_dates(struct date d1, struct date d2); 28 29 int main() 30 { 31 struct date date1, date2; 32 33 printf("Enter Date 1 (dd mm yyyy): "); 34 scanf("%d %d %d", &date1.day, &date1.month, &date1.year); 35 36 printf("Enter Date 2 (dd mm yyyy): "); 37 scanf("%d %d %d", &date2.day, &date2.month, &date2.year); 38 39 if (compare_dates(date1, date2) == 0) 40 printf("The dates are Equal.\n"); 41 else 42 printf("The dates are NOT Equal.\n"); 43 44 return 0; 45 } 46 47 int compare_dates(struct date d1, struct date d2) 48 { 49 if (d1.day == d2.day && d1.month == d2.month && d1.year == d2.year) 50 return 0; 51 else 52 return 1; 53 }