forked from tejaspundpal/Java-programs
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexp1_date.java
More file actions
28 lines (20 loc) · 700 Bytes
/
Copy pathexp1_date.java
File metadata and controls
28 lines (20 loc) · 700 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
package college_programs;
import java.util.Scanner;
public class exp1_date{
public static void main(String[] args){
String[] D = {"Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"};
Scanner sc = new Scanner(System.in);
System.out.println("Enter the date : ");
int date = sc.nextInt();
int Month = sc.nextInt();
int Year = sc.nextInt();
int a = (14 - Month)/12;
int Y= Year - a;
int M = Month + 12 * a -2;
int F = (int)((date + Y + (Y/4) - (Y/100) + (Y/400) + ((31 * M)/12)))%7;
System.out.println(" today day is " + D[F] );
// int date2 = sc.nextInt();
// int Month2 = sc.nextInt();
//int Year2 = sc.nextInt();
}
}