Skip to content

Instantly share code, notes, and snippets.

@ValeraFITIS
Last active August 10, 2019 18:49
Show Gist options
  • Save ValeraFITIS/695789cb89cd784b4ed7f94eb3009407 to your computer and use it in GitHub Desktop.
Save ValeraFITIS/695789cb89cd784b4ed7f94eb3009407 to your computer and use it in GitHub Desktop.
package com.company;
public class Home_2_T_1 {
public static void main(String[] args) {
int a;
a = 8;
if (a%2==0) {
System.out.println("even");
} else {
System.out.println("odd");
}
}
}
package com.company;
public class Home_2_T_2 {
public static void main(String[] args){
for (int a = 0; a <10; a++ )
System.out.println("A will adopt this practices");
}
}
______
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+",");
}
}
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+",");
}
}
package com.company;
import java.util.Scanner;
public class Home_2_T_5 {
public static void main(String[] args){
System.out.println("Введите число");
Scanner scan = new Scanner(System.in);
int a = scan.nextInt();
System.out.println("Введите число на которое делите: ");
int f = scan.nextInt();
for (int x = 1 ;x<=a;x++ ) {
if (x%f==0) {
System.out.print(x+",");
}
}
}
}
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");
}
}
}
}
package com.company;
import java.util.Scanner;
public class Home_2_T_7 {
public static void main(String[]args){
System.out.print("Введите число :");
Scanner scan = new Scanner(System.in);
int a = scan.nextInt();
int rec = 0;
for (int x=0; x<=a;x++){
rec=rec+x;
}
System.out.println( "Результат :" + rec );
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment