Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Jab{
- public static void main(String [] arg){
- Scanner sc = new Scanner(System.in);
- System.out.print("Enter year : (e.g., 2008):");
- int a = sc.nextInt();
- System.out.print("Enter month : 1-12");
- int m = sc.nextInt();
- if(m==1){
- m=13;
- a--;
- }
- if(m==2){
- m=14;
- a--;
- }
- System.out.print("Enter the day of the month : 1-31 :");
- int q = sc.nextInt();
- int j = a/100;
- int k = a%100;
- int h = (q + ((26*(m+1))/10) + k + (k/4) + (j/4)+(5*j))%7;
- String fuck = "";
- switch(h){
- case 0: fuck="Saturday"; break;
- case 1: fuck="Sunday"; break;
- case 2: fuck="Monday"; break;
- case 3: fuck="Tuesday"; break;
- case 4: fuck="Wednesday"; break;
- case 5: fuck="Thursday"; break;
- case 6: fuck="Friday"; break;
- }
- System.out.print("Day of the week is ");
- System.out.print(fuck);
- }
- }
Add Comment
Please, Sign In to add comment