백준알고리즘 1단계 입출력과 사칙연산_java

2557번_Hello World_step01

1
2
3
4
5
public class Main{
    public static void main(String[] args){
        System.out.println("Hello World!");
    }
}


10718번_We love kriii_step02

1
2
3
4
5
6
public class Main {
    public static void main(String args[]){
        System.out.println("강한친구 대한육군");
        System.out.println("강한친구 대한육군");
    }
}


10171번_고양이_step03

1
2
3
4
5
6
7
8
public class Main{
    public static void main(String[] args){
        System.out.println("\    /\");
        System.out.println(" )  ( ')");
        System.out.println("(  /  )");
        System.out.println(" \(__)|");
    }
}


10172번_개_step04

1
2
3
4
5
6
7
8
9
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("||_/=\\__|");
    }
}


1000번_A+B_step05

1
2
3
4
5
6
7
8
9
10
11
12
13
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        Scanner sc=new Scanner(System.in);

        int x,y;
        x = sc.nextInt();
        y = sc.nextInt();

        System.out.printf("%d",x+y);
    }
}


1001번_A-B_step06

1
2
3
4
5
6
7
8
9
10
11
12
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);

        int a = sc.nextInt();
        int b = sc.nextInt();

        System.out.print(a-b);
    }
}


10998번_A*B_step07

1
2
3
4
5
6
7
8
9
10
11
12
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        Scanner sc=new Scanner(System.in);

        int x = sc.nextInt();
        int y = sc.nextInt();

        System.out.print(x*y);
    }
}


1008번_A/B_step08

1
2
3
4
5
6
7
8
9
10
11
12
13
import java.util.*;

public class Main{
    public static void main(String[] args){
        Scanner sc=new Scanner(System.in);

        int x = sc.nextInt();
        int y = sc.nextInt();
        double result = (double)x/y;

        System.out.print(result);
    }
}


10869번_사칙연산_step09

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import java.util.Scanner;

public class Main {
	    public static void main(String[] args){
	        Scanner sc = new Scanner(System.in);

	        int a = sc.nextInt();
	        int b = sc.nextInt();

	        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);

	}
}


10430번_나머지_step10

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();

		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);
	}
}


2588번_곱셈_step11

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);

		int a = sc.nextInt();
		int b = sc.nextInt();

		System.out.println(a*(b%10));
		int tmp = b/10;
		System.out.println(a*(tmp%10));
		tmp=tmp/10;
		System.out.println(a*(tmp%10));
		System.out.println(a*b);
	}
}