Heyy, what's up?
I need some help doing this (it's an assingment, by the way)...
This is my code:
The code prints the same dates... This is based on Oudin's algorithm.Code:#include <stdlib.h> #include <stdio.h> void main(void){ int d, m, y, o; //day, month year, option int c,g,k,i,j,l; //variables needed to calculate the date.. tryagain: printf("Write a year to calculate it's easter date: ", a); scanf("%d", &a); if (a < 1000 || a > 9999){ printf("That year is not valid.\n"); printf("Try again (0 = no/1 = yes): ", o); scanf("%d", &o); if (o == 1) { system("CLS"); goto tryagain; } else { printf("Bye Bye...\n"); } } else if(a>=1000 && a < 10000){ //Calculation of the easter date... c = y/100; g = y % 19; k = (c - 17)/25; i = (c - c/4 - (c - k)/3 + 19*g + 15) % 30; i = i - (i/28)*(1 - (i/28)*(29/(i + 1))*((21 - g)/11)); j = (c + c/4 + i + 2 - c + c/4) % 7; l = i - j; m = 3 + (l + 40)/44; d = l + 28 - 31*(m/4); m = 3+(l+40)/44; d=m+28-31*(m/4); printf("\n==================================\n"); printf("La fecha del Easter es: %d/%d/%d.\n", d, m, c); printf("==================================\n\n"); } printf("Go again (0 = no/1 = yes): ", o); scanf("%d", &o); if (o == 1) { system("CLS"); goto tryagain; } else { printf("Bye...\n"); } system("PAUSE"); return 0; }
Thanks in advance!





Reply With Quote