Last active
December 18, 2015 17:49
-
-
Save Phonbopit/5821519 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main.com.devsharing.loop; | |
public class LoopExample1 { | |
public static void main(String[] args) { | |
int num = 2; | |
for(int j=1; j<=12; j++) { | |
System.out.println(num + " x " + j + " = " + num*j); | |
} | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class LoopExample2 { | |
public static void main(String[] args) { | |
int num = 12; | |
for(int i = 2; i <= num; i++) { | |
for(int j = 1; j <= 12; j++) { | |
System.out.println(i + " x " + j + " = " + i*j); | |
} | |
System.out.print("\n"); | |
} | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Scanner; | |
public class LoopExample3 { | |
public static void main(String[] args) { | |
Scanner scan = new Scanner(System.in); | |
System.out.print("เลือกจำนวนสูตรคูณ : "); | |
int num = scan.nextInt(); | |
for(int i = 2; i <= num; i++) { | |
for(int j = 1; j <= 12; j++) { | |
System.out.println(i + " x " + j + " = " + i*j); | |
} | |
System.out.print("\n"); | |
} | |
scan.close(); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Main { | |
public static void main(String[] args) { | |
System.out.println("Hello World"); | |
System.out.println("Why can't change indent size ?"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment