# 1038, 1039 : 정수 2개 입력 받아 합 출력

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long num1 = sc.nextLong();
        long num2 = sc.nextLong();
        System.out.println(num1+num2);
        sc.close();
    }
}

 

# 1040 : 정수 1개 입력 받아 부호 바꿔 출력

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        System.out.println(a*(-1));
        sc.close();
    }
}

 

# 1041 : 문자 1개 입력 받아 다음 문자 출력

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        char ch1 = sc.next().charAt(0);
        int ch2 = (int)ch1 + 1;
        System.out.println((char)ch2);
        sc.close();
    }
}

 

# 1042 : 정수 2개를 입력 받아 나눈 몫 출력

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int num1 = sc.nextInt();
        int num2 = sc.nextInt();
        System.out.println(num1/num2);
        sc.close();
    }
}

 

# 1043 : 정수 2개 입력 받아 나눈 나머지 출력

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int num1 = sc.nextInt();
        int num2 = sc.nextInt();
        System.out.println(num1%num2);
        sc.close();
    }
}

 

# 1044 : 정수 1개 입력 받아 1 더해 출력

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long num = sc.nextLong();
        System.out.println(num+1);
        sc.close();
    }
}

 

# 1045 : 정수 2개 입력 받아 자동 계산

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);
        System.out.printf("%.2f", (float)a/b);
        sc.close();
    }
}

 

# 1046 : 정수 3개 입력 받아 합과 평균 출력

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.printf("%.1f", (float)(a+b+c)/3);
        sc.close();
    }
}

 

https://codeup.kr/index.php 

 

CodeUp

☆ 파이썬 다운로드 : 파이썬3 ☆ 무료 C언어 IDE : Code::blocks       DEV C++ ☆ 추천 온라인 IDE : C   C++11   Python3   Java ☆ 채점 가능 언어 : C, C++, JAVA, Python 3.5 ★ C++로 제출시 void main()을 사용하면

codeup.kr

 

'CodeUp > Java' 카테고리의 다른 글

[CodeUp] 1049-1052 (Java)  (0) 2022.10.30
[CodeUp] 1047-1048 (Java)  (0) 2022.10.29
[CodeUp] 1031-1037 (Java)  (0) 2022.10.27
[CodeUp] 1028-1030 (Java)  (0) 2022.10.26
[CodeUp] 1010-1027 (Java)  (0) 2022.10.25

+ Recent posts