코드업 기초 100제 (41~50)


1041

import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        char ch = sc.next().charAt(0);

        System.out.print((char)(((int)(ch)+1)));
    }
}

1042

import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n1 = sc.nextInt();
        int n2 = sc.nextInt();

        System.out.print(n1/n2);
    }
}

1043

import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n1 = sc.nextInt();
        int n2 = sc.nextInt();

        System.out.print(n1%n2);
    }
}

1044

import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        Long n1 = sc.nextLong();

        System.out.print(n1+1);
    }
}

1045

import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n1 = sc.nextInt();
        int n2 = sc.nextInt();

        System.out.println(n1+n2);
        System.out.println(n1-n2);
        System.out.println(n1*n2);
        System.out.println(n1/n2);
        System.out.println(n1%n2);
        System.out.format("%.2f",(float)n1/(float)n2);
    }
}

1046

import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n1 = sc.nextInt();
        int n2 = sc.nextInt();
        int n3 = sc.nextInt();

        System.out.println(n1 + n2 + n3);
        System.out.format("%.1f",((float)n1 + (float)n2 + (float)n3)/3);
    }
}

1047

import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n1 = sc.nextInt();

        System.out.println(n1*2);
    }
}

1048

import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n1 = sc.nextInt();
        int n2= sc.nextInt();

        System.out.println((int)(n1 * Math.pow(2,n2)));
    }
}

1049

import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n1 = sc.nextInt();
        int n2 = sc.nextInt();
        int ret;
        if(n1 > n2){
            ret = 1;
        }else{
            ret = 0;
        }
        System.out.print(ret);
    }
}

1050

import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n1 = sc.nextInt();
        int n2 = sc.nextInt();
        int ret;
        if(n1 == n2){
            ret = 1;
        }else{
            ret = 0;
        }
        System.out.print(ret);
    }
}

좋은 웹페이지 즐겨찾기