GOEDUHUB Online Courses || Last Batch Student's Projects || COVID-19 Projects(AI-ML) || Universities  ||  Placement Preparation  Subscribe our youtube channel
+91-7976731765 Free Online Tutorials ||  MACHINE LEARNING || Python || DBMS || OOPs || DSA || Java || Linux/Unix ||  C Programming
Register For Online Free Certified Workshops 
0 like 0 dislike
1.3k views
in Python Programming by Goeduhub's Expert (8k points)
Expected Output:

Input a year: 2019                                                      

Input a month [1-12]: 08                                                

Input a day [1-31]: 23                                                  

The next date is [yyyy-mm-dd] 2019-8-24

1 Answer

0 like 0 dislike
by Goeduhub's Expert (8k points)
 
Best answer
d=int(input("ENTER THE DAY : "))

m=int(input("ENTER THE MONTH : "))

y=int(input("ENTER THE YEAR : "))

 

if ((y % 4 == 0) and (y % 100!= 0)) or (y%400 == 0):

    if m==2:

        d1=29

    elif m==1 or m==3 or m==5 or m==7 or m==8 or m==10 or m==12:

        d1=31

    else :

        d1=30

else:

    if m==2:

        d1=28

    elif m==1 or m==3 or m==5 or m==7 or m==8 or m==10 or m==12:

        d1=31

    else :

        d1=30

if d==31 and m==12 :

    d=1

    m=1

    y=y+1   

elif d1-d==0 :

    m=m+1

    d=1

else:

    d=d+1

    

print("NEXT DAY IS : ",d,"/",m,"/",y)
 Placements:   List of companies | Logical Reasoning Questions | Quantitative Aptitude Questions | General English Questions | Technical-MCQ and Interview Questions
 Important Lists: List of NITsList of IITsList of Exams After Graduation | List of Engineering Entrance Examinations (UG/PG)College ReviewsCollege Fest, Events & WorkshopsKnowledge ShareTrainees/Interns After 15-04-2020
Exams & Cutoffs: JEE Main | JEE Advanced | GATE | IES | ISROList of PSUs || Cutoff-GATECutoff_IIT-JEECS-ScopeECE ScopeEE-Scope
 Download Previous Year Papers For:  GATE | IES | RAJASTHAN TECHNICAL UNIVERSITY (RTU-Kota)RPSC Technical Exams | ISRO
 Goeduhub
About Us | Contact Us   Social::   |  | 
...