Navigation

    GitHub中文社区
    • GitHub排行榜

    论坛

    • Login
    • Categories
    • Recent
    • Tags
    • Popular

    打印1000到2000之间的闰年,并输出一共有多少个。

    技术交流
    1
    1
    112
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • 150930
      150930 last edited by

      #include<stdio.h>
      int main()
      { int year,count=0;
      for(year=1000;year<=2000;year++)
      {
      if(year%4==0&&year%100!=0)
      {

      printf(" %d",year);
      count++;}

      else if (year%400==0)
      {
      printf(" %d",year);
      count++;
      }
      }printf("\n count=%d",count);
      return 0;}

      1 Reply Last reply Reply Quote 0
      • First post
        Last post