-
-
Save FreeFly19/f6c3a1c25438b6b8f23b88f049dcfb33 to your computer and use it in GitHub Desktop.
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
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 { | |
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
package com.company; | |
public class Home_2_T_2 { | |
public static void main(String[] args){ | |
final int COUNT = 10; | |
for (int a = 0; a < COUNT; a++) { | |
System.out.println("A will adopt this 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
package com.company; | |
public class Home_2_T_3 { | |
public static void main(String[] args) { | |
for (int a = 10; a >= 0; a--) { | |
if (a == 0) { | |
System.out.println(a + "."); | |
} else { | |
System.out.print(a + ","); | |
} | |
} | |
} | |
} |
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
package com.company; | |
public class Home_2_T_4 { | |
public static void main(String[] args){ | |
for (int a=0; a<=20; a+=2) System.out.print(a+","); | |
} | |
} |
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
package com.company; | |
import java.util.Scanner; | |
public class Home_2_T_5 { | |
public static void main(String[] args) { | |
Scanner scan = new Scanner(System.in); | |
System.out.print("Введите число: "); | |
int a = scan.nextInt(); | |
System.out.print("Введите число на которое делите: "); | |
int f = scan.nextInt(); | |
for (int x = 1; x <= a; x++) { | |
if (x % f == 0) { | |
System.out.print(x + ","); | |
} | |
} | |
} | |
} |
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
package com.company; | |
public class Home_2_T_6 { | |
public static void main(String[] args) { | |
for (int a = 1; a < 11; a++) { | |
System.out.println(" "); | |
for (int b = 1; b < 11; b++) { | |
int c = b * a; | |
System.out.print(c + "\t"); | |
} | |
} | |
} | |
} |
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
package com.company; | |
import java.util.Scanner; | |
public class Home_2_T_7 { | |
public static void main(String[] args) { | |
Scanner scan = new Scanner(System.in); | |
System.out.print("Введите число :"); | |
int a = scan.nextInt(); | |
int sum = 0; | |
for (int x = 0; x <= a; x++) { | |
sum += x; | |
} | |
System.out.println("Результат :" + sum); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment