"BOJ 9498 시험 성적"의 두 판 사이의 차이

22번째 줄: 22번째 줄:
     }
     }
}
}
</source>
==Python==
<source lang='python'>
score = int(input())
if score >= 90:
    print( 'A' )
elif score >= 80:
    print( 'B' )
elif score >= 70:
    print( 'C' )
elif score >= 60:
    print( 'D' )
else:
    print( 'F' )
</source>
</source>

2018년 7월 27일 (금) 03:41 판

1 개요

BOJ 9498 시험 성적

[[분류:BOJ {{{단계}}}단계]]

  • 시험 점수를 입력받고 성적 출력해보기
  • 알고리즘 분류: 구현

2 Java

import java.util.Scanner;
public class Main {
    private static String getGrade(int score) {
        if( score >= 90 ) return "A";
        if( score >= 80 ) return "B";
        if( score >= 70 ) return "C";
        if( score >= 60 ) return "D";
        return "F";
    }
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        int score = sc.nextInt();
        System.out.print(getGrade(score));
    }
}

3 Python

score = int(input())
if score >= 90:
    print( 'A' )
elif score >= 80:
    print( 'B' )
elif score >= 70:
    print( 'C' )
elif score >= 60:
    print( 'D' )
else:
    print( 'F' )
문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}