Chirurgia cranio-cerebrală minim invazivă
Tehnicile minim invazive impun utilizarea unei tehnologii ultramoderne. Endoscoapele operatorii de diverse tipuri, microscopul operator dedicat, neuronavigația, neuroelectrofiziologia, tehnicile avansate de anestezie, chirurgia cu pacientul treaz reprezintă armamentarium fără de care neurochirurgia prin "gaura cheii" nu ar fi posibilă. Folosind tehnicile de mai sus, tratăm un spectru larg de patologii cranio-cerebrale. www.neurohope.ro |
C | Problema de calculare a datei Pastelui catolic
Last Updated: Feb 23 2022 19:55, Started by
andreixdebu
, Feb 23 2022 11:25
·
0
#1
Posted 23 February 2022 - 11:25
Salut, am un program care ar trebui sa calculeze data Pastelui catolic dupa citirea unui an. Am sa va postez cerinta si ce am incercat sa fac, nu imi iese bine data la unii ani, daca puteti sa ma ajutati va rog sa vedeti ce am facut gresit.
This program takes as command line a single integer value which represents a year and then computes and displays the Easter date for that year The algorithm for computing the catholic Easter date is the following : A = year mod 19 B = year mod 4 C = year mod 7 D = (19 * A + 24) mod 30 E = (2 * B + 4 * C + 6 * D + 5) mod 7 where mod is the remainder of the division of x to y. Easter day is then(22 + E + D) March. Note that this formula can give a date from April if 22 + E + D > 31; also take this case into account! The program will display the Easter date in the following way "The Easter day is 02 April " (use trailing zeros for the day if it is less than 10) #include <stdio.h> #include <stdlib.h> int main() { int Easter; int x,y; scanf("%i",&x); int A,B,C,D,E; A = x % 19; B = x % 4; C = x % 7; D = (19 * A + 24) % 30; E = (2 * B + 4 * C + 6 * D + 5) % 7; Easter = (22 + E + D); if(Easter <= 31) { if (Easter < 10) printf("The Easter day is 0%i March", Easter); else printf("The Easter day is %i March", Easter); } else { y = Easter - 31; if (y < 10) printf("The Easter day is 0%i April", y); else printf("The Easter day is %i April", y); } return 0; } Multumesc anticipat! |
#2
Posted 23 February 2022 - 13:24
Din ce vad, programul e corect.
Doar ca algoritmul e incomplet si limitat: Quote The date of the Easter Sunday can be calculated using the following method derived from the original algorithm by Carl Friedrich Gauss. The algorithm can be applied to the Gregorian calendar for years 1900-2099. The date given by the algorithm is used in Western Christian churches, the date used by the Eastern churches can be 1, 4 or 5 weeks later. More comprehensive forms (including years 1583-9999) of the algorithm exist but they include lenghty tables of Epact and Sunday Letter constants so I won't add them here. a = year mod 19 (use year in four digits) b = year mod 4 c = year mod 7 d = (24+19a) mod 30 e = (5+2b+4c+6d) mod 7 Easter Sunday is on the (22+d+e) of March or on the (d+e-9) of April, depending on which answer is a valid date. If the date given by the algorithm is 26th of April, the Easter Sunday is on 19th of April. If the date is 25th of April and d=28 and a>10, the Easter Sunday is on 18th of April. |
#3
Posted 23 February 2022 - 13:25
printf stie de leading zeros
printf("%02d\n",numar) Tu trebuie sa determini in ce luna pica sarbatoarea. |
#4
Posted 23 February 2022 - 15:33
sunt librarii cu care lucrezi cu date/datetime, ce faci tu se numeste reinventarea rotii.
|
#6
Posted 23 February 2022 - 19:55
if (day > 31) { day-=31; sprintf(month,"%s","April"); } printf ("%02d %s\n", day, month);mai putine if-uri, mai putina bataie de cap _bcristian_, on 23 februarie 2022 - 13:24, said:
Doar ca algoritmul e incomplet si limitat: Edited by MarianG, 23 February 2022 - 19:54. |
Anunturi
▶ 0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users