fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. /* Name of the class has to be "Main" only if the class is public. */
  8. class Ideone
  9. {
  10. public static void main (String[] args) throws java.lang.Exception
  11. {
  12. int first=0;
  13. int second=0;
  14. int third=0;
  15. int sum=0;
  16.  
  17. for(int i=1; i<=1000 ;i++){
  18.  
  19. if(i>=10 && i<100){
  20. first=i/10;
  21. second=i%10;
  22. }
  23.  
  24. if(i>=100 && i<1000){
  25. first=i/100;
  26. second=(i%10)/10;
  27. third=(((i%10)/10)/10);
  28. }
  29.  
  30. if(i==1000){
  31. first=1;
  32. second=0;
  33. third=0;
  34. }
  35.  
  36. sum=first+second+third;
  37.  
  38. if( i%3==0 && i%5!=0 && sum<10 )
  39. {
  40. System.out.println(i);
  41. }
  42. }
  43. }
  44. }
Success #stdin #stdout 0.1s 28816KB
stdin
Standard input is empty
stdout
3
6
9
12
18
21
24
27
33
36
42
51
54
63
72
81
102
108
111
114
117
123
126
129
132
138
141
144
147
153
156
159
162
168
171
174
177
183
186
189
192
198
201
204
207
213
216
219
222
228
231
234
237
243
246
249
252
258
261
264
267
273
276
279
282
288
291
294
297
303
306
309
312
318
321
324
327
333
336
339
342
348
351
354
357
363
366
369
372
378
381
384
387
393
396
399
402
408
411
414
417
423
426
429
432
438
441
444
447
453
456
459
462
468
471
474
477
483
486
489
492
498
501
504
507
513
516
519
522
528
531
534
537
543
546
549
552
558
561
564
567
573
576
579
582
588
591
594
597
603
606
609
612
618
621
624
627
633
636
639
642
648
651
654
657
663
666
669
672
678
681
684
687
693
696
699
702
708
711
714
717
723
726
729
732
738
741
744
747
753
756
759
762
768
771
774
777
783
786
789
792
798
801
804
807
813
816
819
822
828
831
834
837
843
846
849
852
858
861
864
867
873
876
879
882
888
891
894
897
903
906
909
912
918
921
924
927
933
936
939
942
948
951
954
957
963
966
969
972
978
981
984
987
993
996
999