To write a program that accepts one year and decides whether it is a loser or not. The volume is one year if it divides exactly with 4. The year's, however, divided by 100 are not loose apart and cross with 100 are not disjoint unless divided by the 400To write a program that accepts one year and decides whether it is a loser or not. The volume is one year if it divides exactly with 4. The year's, however, divided by 100 are not loose apart and cross with 100 are not disjoint unless divided by the 400.
i try this but is false any help?
#include <stdio.h>
#include <stdlib.h>
int main()
{
long d1,d2,m1,m2,y1,y2,days1,days2,diff,d,m,y;
printf ("Give first date (dd mm yyyy): ");
scanf("%ld %ld %ld",&d1,&m1,&y1);
printf ("Give second date (dd mm yyyy): ");
scanf("%ld %ld %ld",&d2,&m2,&y2);
days1=d1+(m1-1)*30+(y1-1)*360; //Convert date 1 to days
days2=d2+(m2-1)*30+(y2-1)*360; //Convert date 2 to days
diff=days1>days2?days1-days2:days2-days1; //Absolute value of the difference
printf ("The space between the give n dates is %ld days!\n",diff);
y = diff/360;
diff=diff%360;
m=diff/30;
d=diff%30;
//Convert days back to years,months,days
printf ("The space between the given dates is %ld years, %ld months and %ld days!\n",y,m,d);
return 0;
}