Advertisement

c语言刷

阅读量:

金星和地球在某个特定时刻相对于太阳处于一个确定的位置上;已知金星绕太阳运行一周所需时间为225天(约一年又四个月),而地球绕太阳运行一周所需时间为365天(一年)。请问:这两个行星至少需要多少天才能再次同时回到最初的位置上?

答案为(16425)

复制代码
    #include<stdio.h>
    main()
    {
    int a,b,n=0;
    for(a=365;a<(255*365);a++)
      if(a%365==0&&a%225==0)
       break;
    printf("%d\n",a);
    }

全部评论 (0)

还没有任何评论哟~