Last active
October 23, 2016 21:56
-
-
Save ValdemarK/53083edbf714815c3b5a6e037aaef48a to your computer and use it in GitHub Desktop.
Home work #2
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 com.company; | |
| public class Main { | |
| public static void main(String[] args) { | |
| int a = 4; | |
| if(a % 2 == 0) | |
| System.out.println("even"); | |
| else | |
| System.out.println("odd"); | |
| } | |
| } |
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 com.company; | |
| public class Main { | |
| public static void main(String[] args) { | |
| int a = 1; | |
| while(true){ | |
| a++; | |
| System.out.println("I will adopt best practices"); | |
| if(a>7) break; | |
| } | |
| } | |
| } |
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 com.company; | |
| public class Main { | |
| public static void main(String[] args) { | |
| int a = 11; | |
| while(true){ | |
| a--; | |
| System.out.println(a+","); | |
| if(a < 1) break; | |
| } | |
| } | |
| } | |
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 com.company; | |
| public class Main { | |
| public static void main(String[] args){ | |
| for(int i = 0; i <= 20; i = i + 2){ | |
| System.out.print(i); | |
| System.out.print(" "); | |
| } | |
| System.out.println(); | |
| System.out.println(); | |
| } | |
| } |
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 com.company; | |
| import java.util.Scanner; | |
| public class Main { | |
| public static void main(String[] args) { | |
| Scanner sc1 = new Scanner(System.in); | |
| int i = 0; | |
| int n = sc1.nextInt(); | |
| int m = sc1.nextInt(); | |
| while(i < n){ | |
| i++; | |
| if(i % m == 0) | |
| System.out.println(i); | |
| } | |
| } | |
| } | |
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 com.company; | |
| public class Main { | |
| public static void main(String[] args){ | |
| int i, j, a; | |
| for(i = 1; i < 10; i++){ | |
| for(j = 1; j < 10; j++) { | |
| a = i*j; | |
| System.out.print(a); | |
| System.out.print("\t"); | |
| } | |
| System.out.println(); | |
| } | |
| } | |
| } |
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
| - |
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
| - |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment