Coding Club
Eagle Ridge Middle School
Akash Pamal
Session 4 - Nov 2nd
Today’s Talk
Positive / Negative Check
Control Statement - if
if (boolean expression) {� System.out.println("This line is printed if the boolean expression is true");�}
Control Statement - if
int a = 10;
if (a > 0) {� System.out.println("This line is printed if the boolean expression is true");�}
Control Statement - if / else
if (boolean expression) {� System.out.println("This line is printed if the boolean expression is true");�} else {
System.out.println("This line is printed if the boolean expression is false");
}
Control Statement - if / else
int a = 20;
if (a < 0) {� System.out.println("This line is printed if the boolean expression is true");�} else {
System.out.println("This line is printed if the boolean expression is false");
}
Reading Input
import java.util.scanner;
Scanner sc = new Scanner();
int i = sc.nextInt();
Program
import java.util.scanner;
Scanner sc = new Scanner(System.in);
int i = sc.nextInt();
Program
import java.util.scanner;
Public class positiveCheck{
public static void main (String [] args){
Scanner sc = new Scanner(System.in);
int i = sc.nextInt();
System.out.println(i);
}
}
Advanced Problems
public int close10(int a, int b) {
}
Thank You