In this program user enters two dates for comparison. In order to store date we will use structure say date that contains three members namely date, month and year. If the dates are equal then display message as “Dates are Same." otherwise “Both the dates are different”.
int i, f = 0;
struct date d;
for(i = 0; i < 2; i++)
printf("\n Enter day for the %d date \n", i + 1);
printf("\n Enter the month for the %d) date \n", i + 1);
printf("\n Enter the year for the %d) date \n", i + 1);
if(d.date == d.date)
if(d.month == d.month)
if(d.year == d.year)
f = 1;
if(f == 1)
printf("\nDates are Same.");
printf("\nBoth the dates are different.");
ALSO CHECK THESE C PROGRAMS:
- C Program to count the number of words, characters, alphabets, vowels, consonants and digit in a line of text.
- C Program to accept two string and compare the strings are equal or not.
- C Program to sort the entered numbers using bubble sort.
- C Program To Implement Minimum Spanning Tree Using Functions, Pointers & Structures.
- C Program To Implement 8 Queens Problem Using Arrays, Pointers & Functions.
- C Program To Implement Quick Sort Using Pointers, Functions & Arrays.
...Back To C Program Index.