#include <stdio.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define Aththa 1
#define Boru 0
typedef int BOOL;
char* NicNumer;
char* temp;
int year,days,index,WeekDay;
BOOL IsLeap = Boru;
BOOL IsMale = Aththa;
char* Week[] = {"Sunday", "Monday","Tuesday", "Wednesday","Thursday", "Friday", "Saturday"};
char* MonthsOfYear[] ={"January","February","March","April","May","June",
"July","August","September","October","November","December"};
int DaysOfMonth[] ={31,29,31,30,31,30,31,31,30,31,30,31};
int main()
{
NicNumer = (char*)malloc(10);
temp = (char*)malloc(3);
printf("please enter your NIC number :");
scanf("%s",NicNumer);
strncpy(temp,NicNumer,2);
year = atoi(temp);
if(year%4 ==0)
{
IsLeap =Aththa;
}
else
{
IsLeap =Boru;
}
NicNumer = NicNumer+2;
strncpy(temp,NicNumer,3);
days =atoi(temp);
if(days<500)
{
IsMale = Aththa;
}
else
{
IsMale = Boru;
}
while(days>DaysOfMonth[index])
{
days = days-DaysOfMonth[index];
index++;
}
if(index ==1 && IsLeap == Aththa)
{
days--;
}
WeekDay= days%7;
printf("You are a ");
if(IsMale == Aththa)
{
printf("boy ");
}
else
{
printf("girl ");
}
printf("and your birthday is %d %s %d\n",year,MonthsOfYear[index],days);
printf("It was %s\n",Week[WeekDay]);
system("pause");
return 0;
}