public class Main {
public static void main(String[] args) {
System.out.println("Hello World!");
}
}
import java.util.*;
import java.io.*;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer st = new StringTokenizer(bf.readLine());
int A = Integer.parseInt(st.nextToken());
int B = Integer.parseInt(st.nextToken());
int Sum = A + B;
System.out.println(Sum);
}
}
import java.io.*;
import java.util.*;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer st = new StringTokenizer(bf.readLine());
int A = Integer.parseInt(st.nextToken());
int B = Integer.parseInt(st.nextToken());
int Num = A - B;
System.out.println(Num);
}
}
import java.io.*;
import java.util.*;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer st = new StringTokenizer(bf.readLine());
int A = Integer.parseInt(st.nextToken());
int B = Integer.parseInt(st.nextToken());
int Result = A * B;
System.out.println(Result);
}
}
import java.io.*;
import java.util.*;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer st = new StringTokenizer(bf.readLine());
double A = Double.parseDouble(st.nextToken());
double B = Double.parseDouble(st.nextToken());
double Result = A / B;
System.out.println(Result);
}
}
소수점자리가 나오게 하게 Double 사용을 하자
import java.io.*;
import java.util.*;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer st = new StringTokenizer(bf.readLine());
int A = Integer.parseInt(st.nextToken());
int B = Integer.parseInt(st.nextToken());
System.out.println(A+B);
System.out.println(A-B);
System.out.println(A*B);
System.out.println(A/B);
System.out.println(A%B);
}
}
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String name = sc.next();
System.out.println(name+"??!");
}
}
String을 받을때 = next();
Int를 받을때 = nextInt();
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int year = sc.nextInt();
System.out.println(year-543);
}
}
import java.util.*;
import java.io.*;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer st = new StringTokenizer(bf.readLine());
int A = Integer.parseInt(st.nextToken());
int B = Integer.parseInt(st.nextToken());
int C = Integer.parseInt(st.nextToken());
System.out.println((A+B)%C);
System.out.println(((A%C) + (B%C))%C);
System.out.println((A*B)%C);
System.out.println(((A%C) * (B%C))%C);
}
}
import java.util.*;
import java.io.*;
public class Main {
public static void main(String[] args) throws IOException{
BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
int A = Integer.parseInt(bf.readLine());
int B = Integer.parseInt(bf.readLine());
int C = B / 100;
int D = (B % 100) / 10;
int E = ((B % 100) % 10) / 1;
System.out.println(A*E);
System.out.println(A*D);
System.out.println(A*C);
System.out.println((A*E)+(A*D*10)+(A*C*100));
}
}
1의 자리, 10의 자리, 100의 자리 구하기 다른방법도 생각해보기
import java.util.*;
import java.io.*;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer st = new StringTokenizer(bf.readLine());
long A = Long.parseLong(st.nextToken());
long B = Long.parseLong(st.nextToken());
long C = Long.parseLong(st.nextToken());
System.out.println(A+B+C);
}
}
주어진 수가 12억이 넘어가면 Long타입을 사용하자
public class Main {
public static void main(String[] args) {
System.out.println("\\ /\\");
System.out.println(" ) ( ')");
System.out.println("( / )");
System.out.println(" \\(__)|");
}
}
\ 를 사용하려면 \\
public class Main {
public static void main(String[] args) {
System.out.println("|\\_/|");
System.out.println("|q p| /}");
System.out.println("( 0 )\"\"\"\\");
System.out.println("|\"^\"` |");
System.out.println("||_/=\\\\__|");
}
}
"를 사용하려면 \"