Guest User

Untitled

a guest
Dec 11th, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.88 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Jab{
  4. public static void main(String [] arg){
  5. Scanner sc = new Scanner(System.in);
  6. System.out.print("Enter year : (e.g., 2008):");
  7. int a = sc.nextInt();
  8. System.out.print("Enter month : 1-12");
  9. int m = sc.nextInt();
  10. if(m==1){
  11. m=13;
  12. a--;
  13. }
  14. if(m==2){
  15. m=14;
  16. a--;
  17. }
  18. System.out.print("Enter the day of the month : 1-31 :");
  19. int q = sc.nextInt();
  20. int j = a/100;
  21. int k = a%100;
  22. int h = (q + ((26*(m+1))/10) + k + (k/4) + (j/4)+(5*j))%7;
  23. String fuck = "";
  24.  
  25. switch(h){
  26. case 0: fuck="Saturday"; break;
  27. case 1: fuck="Sunday"; break;
  28. case 2: fuck="Monday"; break;
  29. case 3: fuck="Tuesday"; break;
  30. case 4: fuck="Wednesday"; break;
  31. case 5: fuck="Thursday"; break;
  32. case 6: fuck="Friday"; break;
  33. }
  34.  
  35. System.out.print("Day of the week is ");
  36. System.out.print(fuck);
  37. }
  38. }
Add Comment
Please, Sign In to add comment