Advertisement
Guest User

Untitled

a guest
Sep 17th, 2019
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7. int rok;
  8. int a; // rok%19;
  9. int b; // rok%4;
  10. int c; // rok%7;
  11. int d; // (19*a+A)%19;
  12. int e; // (2*b+4*c+6*d+B)%7;
  13. int A;
  14. int B;
  15. int wielkanoc;
  16.  
  17. cout << "Podaj rok: ";
  18. cin >> rok;
  19.  
  20. if(rok>=1800 && rok<=1899){
  21. A = 23;
  22. B = 4;
  23. }
  24. if(rok>=1900 && rok<=2099){
  25. A = 24;
  26. B = 5;
  27. }
  28. if(rok>=2100 && rok<=2199){
  29. A = 24;
  30. B = 6;
  31. }
  32.  
  33. a = rok%19;
  34. b = rok%4;
  35. c = rok%7;
  36. d = (19*a+A)%30;
  37. e = (2*b+4*c+6*d+B)%7;
  38.  
  39. wielkanoc = 22+d+e;
  40.  
  41. if(wielkanoc<31){
  42. cout << "Wielkanoc wypada " << wielkanoc << " marca";
  43. }else{
  44. cout << "Wielkanoc wypada " << (wielkanoc-31) << " kwietnia";
  45. }
  46.  
  47.  
  48. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement