Using structure, write a program that determines number of days between two given dates.(e.g. the given dates represent the republic day and Independence day in an year.)

struct date

{

int d,m,y;

};

void main()

{

struct date d1={26,1,2021};

struct date d2={15,8,2021};

int total_days,days;

int mon,jandays,augdays;

clrscr();

mon=(d2.m-1)-d1.m;

jandays=31-26;

augdays=15;

days=jandays+augdays;

total_days=mon*30+days;

printf(" \n Days difference between Republic day and Independence day is : %d",total_days);

getch();

}


output:

Days difference between Republic day and Independence day is : 200