profile picture

Anonymous

upvote

0

downvote

0

star

Viết chương trình nhập hai số tự nhiên Y1, Y2 là số năm, Y2 > Y1

clock icon

- asked 6 months agoVotes

message

0Answers

eye

0Views

Vận dụng 1 trang 152 Tin học 10: Viết chương trình nhập hai số tự nhiên Y1, Y2 là số năm, Y2 > Y1. Tính xem trong khoảng thời gian từ năm Y1 đến năm Y2 có bao nhiêu năm nhuận. Áp dụng tính xem trong thế kỉ XXI có bao nhiêu năm nhuận.

Trả lời:

defKTNN(n):

if n%400==0:return1if n%4==0and n%100!=0:return1return0defDemNN(y1,y2):
    d=0for i inrange(y1,y2+1):if KTNN(i)==1:d=d+1return dy1=int(input("Nhập năm y1:"))y2=int(input("Nhập năm y2:"))print("Số năm nhuận:",DemNN(y1,y2))print("Số năm nhuận của thế kỉ XXI là:",DemNN(2001,2100))

Bài tập liên quan

Write your answer here

© 2025 Pitomath. All rights reserved.