User Tools

Site Tools


cs:c_language:leap_year

logo skenz.it

Return to Home page

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

cs:c_language:leap_year [2017/11/21 14:03]
127.0.0.1 external edit
cs:c_language:leap_year [2018/11/20 10:54] (current)
zioskenz
Line 25: Line 25:
  
 int main(void){ int main(void){
-  int bis=0;+  int leap=0;
   int year;   int year;
  
Line 31: Line 31:
   scanf("​%d",​ &year);   scanf("​%d",​ &year);
  
-  /* First solution: base on a support varible ​bis */+  /* First solution: base on a support varible ​leap */
   if ( year%4==0 )   /* divisible by 4 */   if ( year%4==0 )   /* divisible by 4 */
-    ​bis=1;+    ​leap=1;
  
   if ( year%100==0 ) /* but not by 100 */   if ( year%100==0 ) /* but not by 100 */
-    ​bis=0;+    ​leap=0;
  
   if ( year%400==0 ) /* but year divisible by 400 are leap years */   if ( year%400==0 ) /* but year divisible by 400 are leap years */
-    ​bis=1;+    ​leap=1;
  
-  if ( bis==1 ){+  if ( leap==1 ){
     printf("​%d is a leap year\n",​ year);     printf("​%d is a leap year\n",​ year);
   }else{   }else{

If you found any error, or if you want to partecipate to the editing of this wiki, please contact: admin [at] skenz.it

You can reuse, distribute or modify the content of this page, but you must cite in any document (or webpage) this url: https://www.skenz.it/cs/c_language/leap_year?rev=1542707661&do=diff
/web/htdocs/www.skenz.it/home/data/pages/cs/c_language/leap_year.txt ยท Last modified: 2018/11/20 10:54 by zioskenz

Privacy Policy