1, output 100 odd and even number and (not including 100);
2, the output 1-1000 can be divisible by 5 number, and each line output 3 lines;
3, print out 99 multiplication table
Public classTest { Public Static voidMain (string[] args) {//within 100 odd and even numbers and (not included)System.out.println ("*************100 with inside odd and even numbers and ************"); intoddsum = 0;//Odd and Alt +shift+r bulk modification of variable names intevensum = 0;//even and for(inti = 0;i<100;i++){ if(i%2==0) {evensum+=i; } Else{oddsum+=i; }} System.out.println ("Less than 100 odd and:" +oddsum); System.out.println ("100 Even and:" +evensum); //number of outputs 1-1000 that can be divisible by 5, and output 3 rows per lineSystem.out.println ("\n************* output 1-1000 can be divisible by 5 number, and each line output 3 lines ************"); for(intj = 1;j<=1000;j++){ if(j%5==0){ if(j%3==0) {System.out.println (J+ "\ T"); } Else{System.out.print (J+ "\ T"); } } } //Print output 99 multiplication tableSystem.out.println ("\n\n************ Print output 99 multiplication table **************"); for(inti = 1;i<=9;i++){ for(intj = 1;j<=i;j++) {System.out.print (J+ "*" +i+ "\ T"); if(i==j) {System.out.println (); } } } }}
Output Result:
Within 100 odd and even numbers and ************
Within 100 odd and: 2500
100 Even and: 2450
************* output 1-1000 can be divisible by 5, and each line output 3 lines ************
51015
202530
354045
505560
657075
808590
95100105
110115120
125130135
140145150
155160165
170175180
185190195
200205210
215220225
230235240
245250255
260265270
275280285
290295300
305310315
320325330
335340345
350355360
365370375
380385390
395400405
410415420
425430435
440445450
455460465
470475480
485490495
500505510
515520525
530535540
545550555
560565570
575580585
590595600
605610615
620625630
635640645
650655660
665670675
680685690
695700705
710715720
725730735
740745750
755760765
770775780
785790795
800805810
815820825
830835840
845850855
860865870
875880885
890895900
905910915
920925930
935940945
950955960
965970975
980985990
9951000
Print output 99 multiplication table **************
1*1
1*22*2
1*32*33*3
1*42*43*44*4
1*52*53*54*55*5
1*62*63*64*65*66*6
1*72*73*74*75*76*77*7
1*82*83*84*85*86*87*88*8
1*92*93*94*95*96*97*98*99*9
Java 0 Basic Series 006--small Test (loop)