inblog logo
|
stupefyee
    알고리즘문제풀기

    [JAVA 문제 풀이] 98. 홀짝 구분하기

    프로그래머스 (181944)
    Stupefyee's avatar
    Stupefyee
    Feb 21, 2025
    [JAVA 문제 풀이] 98. 홀짝 구분하기
    Contents
    내가 작성한 코드
    school.programmers.co.kr
    https://school.programmers.co.kr/learn/courses/30/lessons/181944
    notion image
     

    내가 작성한 코드

    import java.util.Scanner; public class Solution { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); if( n % 2 == 0 ) { System.out.println(n + " is even"); } else { System.out.println(n + " is odd"); } // System.out.print(n + " is " + (n % 2 == 0 ? "even" : "odd")); } }
    Share article
    Contents
    내가 작성한 코드

    stupefyee

    RSS·Powered by Inblog