TA的每日心情 | 开心 2021-3-12 23:18 |
---|
签到天数: 2 天 [LV.1]初来乍到
|
C语言趣味程序百例精解之java实现(37)

程序:
- public class Test37{
- public static void main(String args[]){
- ShangLou37();
- }
- // int i=1;
- // while(!((i%2==1)&&(i%3==2)&&(i%5==4)&&(i%6==5)&&(i%7==0)))
- // i=i+7;
- //System.out.printf("Staris_number=%d
- ",i);
- // }
- /**
- * 37 上楼问题
- */
- public static void ShangLou37() {
- for (int i = 7; i < 10000; i++) {
- if (i % 2 == 1 && i % 3 == 2 && i % 5 == 4 && i % 6 == 5
- && i % 7 == 0) {
- System.out.println(i);
- }
- }
-
- }
- }
- C:at>java Test37
- 119
- 329
- 539
- 749
- 959
- 1169
- 1379
- 1589
- 1799
- 2009
- 2219
- 2429
- 2639
- 2849
- 3059
- 3269
- 3479
- 3689
- 3899
- 4109
- 4319
- 4529
- 4739
- 4949
- 5159
- 5369
- 5579
- 5789
- 5999
- 6209
- 6419
- 6629
- 6839
- 7049
- 7259
- 7469
- 7679
- 7889
- 8099
- 8309
- 8519
- 8729
- 8939
- 9149
- 9359
- 9569
- 9779
- 9989
-
复制代码
源码下载:http://file.javaxxz.com/2014/11/18/000607718.zip |
|