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
| class Ex1 { | |
| public static void main(String args[]) { | |
| int a = 4; | |
| System.out.print(a); | |
| if (a % 2 == 0) { | |
| System.out.println(" is Even number"); | |
| } else { | |
| System.out.println(" is Odd number"); | |
| } |
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
| import java.util.Scanner; | |
| public class Ex1 { | |
| public static void main(String[] args) { | |
| Scanner in = new Scanner(System.in); | |
| System.out.print("Введіть додатне число = "); | |
| int a = in.nextInt(); |
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 Home_2_T_1 { | |
| public static void main(String[] args) { | |
| int a = 8; | |
| if (a%2==0) { | |
| System.out.println("even"); | |
| } else { |
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
| /** | |
| * Created by Чуєнко Віталій on 19.10.2016. | |
| */ | |
| public class Ex1 { | |
| public static void main(String[] args) { | |
| int a = 4; | |
| if (a % 2 == 0) { | |
| System.out.println("even"); | |
| } else { |
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
| /** | |
| * Created by Igor on 19.10.2016. | |
| */ | |
| public class EightSum { | |
| public static void main(String[] args) { | |
| for (int i = 1; i <= 10; i++) { | |
| for (int j = 1; j <= 10; j++) { | |
| if (i < j) { | |
| System.out.print("#"); | |
| } else { |
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 sc = new Scanner(System.in); | |
| System.out.print("Введіть число:"); | |
| int a = sc.nextInt(); | |
| if (a > 0) { |
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 homework2; | |
| import java.util.Scanner; | |
| /** | |
| * Created by Denis on 18.10.2016. | |
| */ | |
| public class ArithmeticProgression { | |
| public static void main(String[] args) { |
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
| class Ex1 { | |
| public static void main(String[] args){ | |
| // Умовний оператор(оператор гілкування, на рос. "ветвления") | |
| // Може виконувати одну із двох дій в залежності від виконання або не виконання певної умови | |
| if (true) {// true - спеціальне зарезервоване слово, одне із двох значень, яких може набувати змінна типу boolean, протележне слово false | |
| System.out.println("This is true"); | |
| } else { | |
| System.out.println("This is false"); | |
| } | |
| // Вище наведена повна форма оператора if(з else) |