Skip to content

Instantly share code, notes, and snippets.

@FreeFly19
Forked from IgorCherniavsky/EighthSum
Last active October 23, 2016 21:35
Show Gist options
  • Save FreeFly19/48549c0d0ccc7b5cdafd51f3cf437a9c to your computer and use it in GitHub Desktop.
Save FreeFly19/48549c0d0ccc7b5cdafd51f3cf437a9c to your computer and use it in GitHub Desktop.
SecondHomework
/**
* 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 {
System.out.print(i * j);
}
System.out.print("\t");
}
System.out.println();
}
}
}
import java.util.Scanner;
/**
* Created by Igor on 18.10.2016.
*/
public class FiveSum {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.print("Enter value m: ");
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 + " ");
}
}
}
}
/**
* Created by Igor on 18.10.2016.
*/
public class FirstSum{
public static void main(String[] args) {
int i = 5;
if (i % 2 == 0) {
System.out.println("even");
} else {
System.out.println("odd");
}
}
}
/**
* 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 + " ");
}
}
}
/**
* Created by Igor on 18.10.2016.
*/
public class SecondSum {
public static void main(String[] args) {
final int COUNT = 7;
for (int i = 1; i <= COUNT; i++) {
System.out.println("I will adopt best practices");
}
}
}
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);
System.out.print("Введіть останній елемент прогресії: ");
int n = sc.nextInt();
int sum = 0;
for (int i = 1; i <= n; i++) {
sum += i;
}
System.out.print(sum);
}
}
/**
* 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();
}
}
}
/**
* 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