ios入门之c语言篇——基本函数——2——判断闰年

2.闰年判断

参数返回值解析:

 

参数:

a:int,年份;

 

返回值:

1:闰年;

0:非闰年;

 1 int leapyear(int a)
 2 
 3 {
 4 
 5     if(a%400==0)
 6 
 7     {
 8 
 9         return 1;
10 
11     }
12 
13     if(a%100==0)
14 
15     {
16 
17         return 0;
18 
19     }
20 
21     if(a%4==0)
22 
23     {
24 
25         return 1;
26 
27     }
28 
29     return 0;
30 
31  
32 
33 }
View Code

 

posted @ 2015-07-25 16:43  孔凡凯凯  阅读(790)  评论(0编辑  收藏  举报