Created
October 19, 2016 12:07
-
-
Save IgorCherniavsky/012cc1639e7cae5b9621cb685d8b701b to your computer and use it in GitHub Desktop.
SecondHomework
This file contains 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
/** | |
* Created by Igor on 19.10.2016. | |
*/ | |
public class EightSum { | |
public static void main(String[] args) { | |
String m = "#"; | |
for (int i = 1; i <= 10; i++){ | |
for (int j = 1; j <= 10; j++){ | |
if(i<j) { | |
System.out.print("#"); | |
} | |
else System.out.print(i*j); | |
System.out.print("\t"); | |
} | |
System.out.println(); | |
} | |
} | |
} |
This file contains 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; | |
/** | |
* Created by Igor on 18.10.2016. | |
*/ | |
public class FiveSum { | |
public static void main(String[] args) { | |
System.out.print("Enter value m : "); | |
Scanner sc = new Scanner(System.in); | |
int m = Integer.parseInt(sc.nextLine()); | |
System.out.print("Enter value n :"); | |
int n = Integer.parseInt(sc.nextLine()); | |
for(int i = 1; i <= n; i++){ | |
if (i%m == 0) | |
System.out.print(i + " "); | |
} | |
} | |
} |
This file contains 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
/** | |
* Created by Igor on 18.10.2016. | |
*/ | |
public class FirstSum{ | |
public static void main(String[] args) { | |
int i = 6; | |
if(i%2==0){ | |
System.out.println("even"); | |
} | |
else | |
System.out.println("odd"); | |
} | |
} |
This file contains 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
/** | |
* Created by Igor on 18.10.2016. | |
*/ | |
public class FourthSum { | |
public static void main(String[] args) { | |
for(int i = 0; i <= 20; i += 2){ | |
System.out.print( i + " " ); | |
} | |
} | |
} |
This file contains 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
/** | |
* Created by Igor on 18.10.2016. | |
*/ | |
public class SecondSum { | |
public static void main(String[] args) { | |
for (int i=1; i<=7;i++){ | |
System.out.println("I will adopt best practices"); | |
} | |
} | |
} |
This file contains 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; | |
/** | |
* Created by Igor on 19.10.2016. | |
*/ | |
public class Seven { | |
public static void main(String[] args) { | |
Scanner sc = new Scanner(System.in); | |
int n = Integer.valueOf(sc.nextLine()); | |
int k = 0; | |
for (int i = 1; i <= n; i++){ | |
k+=i; | |
} | |
System.out.print(k + ""); | |
} | |
} |
This file contains 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
/** | |
* Created by Igor on 18.10.2016. | |
*/ | |
public class MultiplicationTable { | |
public static void main(String[] args) { | |
for (int i = 1; i <= 10; i++) { | |
for (int j = 1; j <= 10 ; j++) { | |
System.out.print(i*j); | |
System.out.print("\t"); | |
} | |
System.out.println(); | |
} | |
} | |
} | |
This file contains 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
/** | |
* Created by Igor on 18.10.2016. | |
*/ | |
public class ThirdSum { | |
public static void main(String[] args) { | |
for(int i = 10 ; i >= 0; i--){ | |
if (i == 0){ | |
System.out.print(i + " "); | |
} | |
else System.out.print(i + ","); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment