Skip to content

Instantly share code, notes, and snippets.

@javadovjavad
Created September 12, 2014 11:42
Show Gist options
  • Save javadovjavad/5776955ee1b472051a22 to your computer and use it in GitHub Desktop.
Save javadovjavad/5776955ee1b472051a22 to your computer and use it in GitHub Desktop.
import java.util.Scanner;
public class IfKontrolleri {
public static void main(String[] args) {
System.out.println("yasinizi daxil edin:");
Scanner sc = new Scanner(System.in);
int yas = sc.nextInt();
if (yas >= 18) {
System.out.println("Resitsiniz");
} else {
System.out.println("resit deyilsiniz");
}
System.out.println("yasinizi daxil edin:");
String isim = sc.nextLine();
if (yas>=18 && isim=="Ahmet"){
System.out.println();
}else{
}
// System.out.println(yas>=18); // true - false
}
}
import java.util.Scanner;
public class KonsolGirdi {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.println("Isminizi girin:");
String input = sc.nextLine();
System.out.println("Merhaba "+input);
System.out.println("yasiniz Nedir?");
int yas = sc.nextInt();
System.out.println("Yasiniz "+yas);
}
}
public class Operatorler {
public static void main(String[] args) {
int sayi1 = 92323;
int sayi2 = 45646;
int toplam = sayi1 + sayi2;
System.out.println(toplam);
System.out.println(sayi1 - sayi2);
int buyukSay = 245454;
int kalan = buyukSay * 23;
System.out.println(kalan);
int bolunen = 344;
int bolen = 3;
int bolum = bolunen / bolen;
System.out.println(bolum);
// kisa operatorlar
int x = 2;
int y = x++;
int z = --x;
// x += 23;
System.out.println("x: " + x);
System.out.println("y: " + y);
System.out.println("z: " + z);
// ---------
int x1 = 12;
int y2 = x1;
x1++;
System.out.println(x1);
System.out.println(y2);
// / toplama olmaz
System.out.println("aaaa" + 25 + 55);
// // toplama olar
System.out.println("aaaa" + (25 + 55));
// Oyun
int q, f, hj, ju, lu;
q = 30;
f = 56;
hj = 70;
ju = 4;
lu = 2;
int topla1 = q + f; // 86
int cixma1 = hj - ju; // 66
int bol = topla1 / cixma1;
int vurma = bol * lu;
System.out.println(vurma);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment