Skip to content

Instantly share code, notes, and snippets.

@ValdemarK
Last active October 23, 2016 21:56
Show Gist options
  • Save ValdemarK/53083edbf714815c3b5a6e037aaef48a to your computer and use it in GitHub Desktop.
Save ValdemarK/53083edbf714815c3b5a6e037aaef48a to your computer and use it in GitHub Desktop.
Home work #2
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");
}
}
package com.company;
public class Main {
public static void main(String[] args) {
int a = 1;
while(true){
a++;
System.out.println("I will adopt best practices");
if(a>7) break;
}
}
}
package com.company;
public class Main {
public static void main(String[] args) {
int a = 11;
while(true){
a--;
System.out.println(a+",");
if(a < 1) break;
}
}
}
package com.company;
public class Main {
public static void main(String[] args){
for(int i = 0; i <= 20; i = i + 2){
System.out.print(i);
System.out.print(" ");
}
System.out.println();
System.out.println();
}
}
package com.company;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc1 = new Scanner(System.in);
int i = 0;
int n = sc1.nextInt();
int m = sc1.nextInt();
while(i < n){
i++;
if(i % m == 0)
System.out.println(i);
}
}
}
package com.company;
public class Main {
public static void main(String[] args){
int i, j, a;
for(i = 1; i < 10; i++){
for(j = 1; j < 10; j++) {
a = i*j;
System.out.print(a);
System.out.print("\t");
}
System.out.println();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment