Ans:->
The program that compares two input dates by using pointers. To store a data use a structure that contains three members namely date, month and year. If the dates are equal then display message as "Equal" otherwise "Unequal" in C language.
Program is as follows:--
#include<stdio.h>
struct date
{
int day;
int month;
int year;
};
void main()
{
struct date d1,d2,*D1,*D2;
D1=&d1;
D2=&d2;
printf("Enter the First date dd/mm/yyyy:");
scanf("%d%d%d",&D1->day,&D1->month,&D1->year);
printf("Enter the Second date dd/mm/yyyy:");
scanf("%d%d%d",&D2->day,&D2->month,&D2->year);
if((D1->day==D2->day)&&(D1->month==D2->month)&&(D1->year==D2->year))
printf("EQUAL");
else
printf("UNEQUAL");
}
OUTPUT:-
Enter the First date dd/mm/yyyy :
12
06
2018
Enter the Second date dd/mm/yyyy
18
05
2020
UNEQUAL
0 Comments
If you want to give any suggestion regarding the post please feel free to Comment below-