Anda di halaman 1dari 6

/*PROGRAM NAME: ZODIAC CALENDAR

*AUTHOR: JUNELL DELOS SANTOS


*DATE CREATED: 08/21/2010
*/

#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
int m;
int d;
int cy;
int day;
int age;
int i;
int y;
int r=0,r1=0,r2=0,s=0;
char name[70];
char cont;
while(cont=='Y'|| cont=='y');
printf("\n\nEnter your name: ");
gets(name);
printf("Enter current year: ");
scanf("%d",&cy);
printf("Enter the month of your birthday-> ");
scanf("%d",&m);
printf("Enter the day of your birthday-> ");
scanf("%d",&d);
printf("Enter the year of your birthday-> ");
scanf("%d",&y);

if ((m==3)&&(d>=20)&&(d<=31))
{
printf("\nUnder the zodiac sign ARIES.");
}
else
if ((m==4)&&(d>=1)&&(d<=19))
{
printf("\nUnder the zodiac sign ARIES.");
}
else

if ((m==4)&&(d>=20)&&(d<=31))
{
printf("\nUnder the zodiac sign TAURUS.");
}
else

if ((m==5)&&(d>=1)&&(d<=20))
{
printf("\nUnder the zodiac sign TAURUS.");
}
else
if ((m==6)&&(d>=21)&&(d<=31))
{
printf("\nUnder the zodiac sign GEMINI.");
}
else

if ((m==6)&&(d>=1)&&(d<=20))
{
printf("\nUnder the zodiac sign GEMINI.");
}
else

if ((m==6)&&(d>=21)&&(d<=31))
{
printf("\nUnder the zodiac sign CANCER.");
}
else

if ((m==7)&&(d>=1)&&(d<=20))
{
printf("\nUnder the zodiac sign CANCER.");
}
else

if ((m==7)&&(d>=21)&&(d<=31))
{
printf("\nUnder the zodiac sign LEO.");
}
else

if ((m==8)&&(d>=1)&&(d<=20))
{
printf("\nUnder the zodiac sign LEO.");
}
else

if ((m==8)&&(d>=21)&&(d<=31))
{
printf("\nUnder the zodiac sign VIRGO.");
}
else

if ((m==9)&&(d>=1)&&(d<=22))
{
printf("\nUnder the zodiac sign VIRGO.");
}
else

if ((m==9)&&(d>=23)&&(d<=31))
{
printf("\nUnder the zodiac sign LIBRA.");
}
else

if ((m==10)&&(d>=1)&&(d<=22))
{
printf("\nUnder the zodiac sign LIBRA.");
}
else

if ((m==10)&&(d>=23)&&(d<=31))
{
printf("\nUnder the zodiac sign SCORPIO.");
}
else

if ((m==11)&&(d>=1)&&(d<=22))
{
printf("\nUnder the zodiac sign SCORPIO.");
}
else

if ((m==11)&&(d>=23)&&(d<=31))
{
printf("\nUnder the zodiac sign SAGITTARIUS.");
}
else

if ((m==12)&&(d>=1)&&(d<=22))
{
printf("\nUnder the zodiac sign SAGITTARIUS.");
}
else

if ((m==12)&&(d>=23)&&(d<=31))
{
printf("\nUnder the zodiac sign CAPRICORN.");
}
else

if ((m==1)&&(d>=1)&&(d<=19))
{
printf("\nUnder the zodiac sign CAPRICORN.");
}
else

if ((m==1)&&(d>=20)&&(d<=31))
{
printf("\nUnder the zodiac sign AQUARIUS.");
}
else
if ((m==2)&&(d>=1)&&(d<=19))
{
printf("\nUnder the zodiac sign AQUARIUS.");
}
else

if ((m==2)&&(d>=20)&&(d<=31))
{
printf("\nUnder the zodiac sign PISCES.");
}
else

if ((m==3)&&(d>=1)&&(d<=19))
{
printf("\nUnder the zodiac sign PISCES.");
}
printf("You are %s was born on %d,%d,%d ",name,m,d,y);
{
{
if(m==2){
if((d>28)&&(y%4!=0)){
printf("Invalid date in February of non leap year.The maximumvalue is 28");
}
if((d>29)&&(y%4==0)){
printf("Invalid date in February of leap year.The maximumvalue is 29");
}
}
else if((m==1)||(m==3)||(m==5)||(m==7)||(m==8)||(m==10)||(m==12)){
if(d>31){
printf("Invalid date in %d the month.The maximum value is31",m);
}
}
else if(((m==4)||(m==6)||(m==9)||(m==11))&&(d>30)){
printf("Invalid date in the %d the month.The maximum value is 30",m);
}
else if((d>31)){
printf("Enter valid date");
}
if((d<1)||(m<1)){
printf("invalid data");
}
else {
switch(m){
case 1:
case 10:
r1=d+2;
break;
case 2:
case 3:
case 11:
r1=d+5;
break;
case 4:
case 7:
r1=d+1;
break;
case 9:
case 12:
r1=d;
break;
case 5:
r1=d+3;
break;
case 6:
r1=d+6;
break;
case 8:
r1=d+4;
break;
default:
{
printf("Enter valid month Once again enter the Date Month Year");
}
}
}
if(y<2003){
for(i=2002;i>=y;i--){
if((i==y)&&(i%4==0)){
if(m>2) s=s+1;
else if(m<=2) s=s+2;
break;
}
else if(i%4==0){
if(i%100==0){
if(i%400==0)
s=s+2;
else s=s+1;
}
else s=s+2;
}
else s=s+1;
}
r2=7-s%7;
}
else if(y>2003){
for(i=2004;i<=y;i++){
if((i==y)&&(i%4==0)){
if(m>2) s=s+2;
else if(m<=2) s=s+1;
break;
}
else if(i%4==0){
if(i%100==0){
if(i%400==0)
s=s+2;
else s=s+1;
}
else s=s+2;
}
else s=s+1;
}
r2=s%7;
}
else r2=0;
r=(r1+r2)%7;
printf("");
switch(r){
case 0:
printf("SUNDAY.");
break;
case 1:
printf("MONDAY.");
break;
case 2:
printf("TUESDAY.");
break;
case 3:
printf("WEDNESDAY.");
break;
case 4:
printf("THURSDAY.");
break;
case 5:
printf("FRIDAY.");
break;
case 6:
printf("SATURDAY.");
break;
}
}
{
age=cy-y;
printf(" in %d,%d,%d you will be %d of age",m,d,cy,age);
}
printf("\n\nContinue? Y/N:");
cont=getche();
}
}

Anda mungkin juga menyukai