We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
  • HackerRank Home

    HackerRank

  • |
  • Prepare
  • Certify
  • Compete
  • Hiring developers?
  1. Prepare
  2. Tutorials
  3. 10 Days of Javascript
  4. Day 2: Conditional Statements: If-Else

Day 2: Conditional Statements: If-Else

Problem
Submissions
Leaderboard
Discussions
Editorial
Topics

Objective

In this challenge, we learn about if-else statements. Check out the attached tutorial for more details.

Task

Complete the getGrade(score) function in the editor. It has one parameter: an integer, , denoting the number of points Julia earned on an exam. It must return the letter corresponding to her according to the following rules:

  • If , then .
  • If , then .
  • If , then .
  • If , then .
  • If , then .
  • If , then .

Input Format

Stub code in the editor reads a single integer denoting from stdin and passes it to the function.

Constraints

Output Format

The function must return the value of (i.e., the letter grade) that Julia earned on the exam.

Sample Input 0

11

Sample Output 0

D

Explanation 0

Because , it satisfies the condition (which corresponds to D). Thus, we return D as our answer.

Author

AvmnuSng

Difficulty

Easy

Max Score

10

Submitted By

130251

Need Help?


View discussions
View editorial
View top submissions
RESOURCES

  • If-Else Conditional Statements

rate this challenge

MORE DETAILS

Download problem statement
Download sample test cases
Suggest Edits
  • Blog
  • Scoring
  • Environment
  • FAQ
  • About Us
  • Support
  • Careers
  • Terms Of Service
  • Privacy Policy