Last active
February 5, 2018 16:11
-
-
Save AmirulLearn/f74b20179672c78922575b578450f1af to your computer and use it in GitHub Desktop.
This coding will determine what day you were borned . Please have a try :')
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<stdio.h> | |
int main () | |
{ | |
int day,month,yf,yb,w,ans; | |
printf("\tThis is a program to determine your day of born by using your birth date\n\n"); | |
printf("Please enter the information needed \n"); | |
printf("Date of birth : "); | |
scanf("%d", &day); | |
printf("\n\nNotes: Please enter your month according to this : \n\n\n"); | |
printf("January = 11 \n"); | |
printf("February = 12 \n"); | |
printf("Mac = 1 \n"); | |
printf("April = 2 \n"); | |
printf("May = 3 \n"); | |
printf("June = 4 \n"); | |
printf("July = 5 \n"); | |
printf("August = 6 \n"); | |
printf("September = 7 \n"); | |
printf("October = 8 \n"); | |
printf("November = 9 \n"); | |
printf("Disember = 10 \n"); | |
printf("\nMonth : "); | |
scanf("%d", &month); | |
printf("\nFirst 2 digit in Year you were borned : "); | |
scanf("%d", &yf); | |
printf("\nLast 2 digit in Year you were borned : "); | |
scanf("%d", &yb); | |
if (month==11 || month ==12) | |
yb=yb-1; | |
//formula// | |
w=day+(2.6*month-0.2)-2*yf+yb+(yb/4)+(yf/4); | |
// printf("\n %d \n",w); | |
ans= w % 7; | |
printf("\n\n"); | |
if(ans==0) | |
printf("Your birthday is on Sunday\n"); | |
else if(ans==1) | |
printf("Your birthday is on Monday\n"); | |
else if(ans==2) | |
printf("Your birthday is on Tuesday\n"); | |
else if(ans==3) | |
printf("Your birthday is on Wednesday\n"); | |
else if(ans==4) | |
printf("Your birthday is on Thursday\n"); | |
else if(ans==5) | |
printf("Your birthday is on Friday\n"); | |
else if(ans==6) | |
printf("Your birthday is on Saturday\n"); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment