R_Code-10.r ​
Metadata ​
- Author — Amit Dutta (amitdutta4255@gmail.com)
- Last updated — 20 Mar 2026
- License — MIT
Problem Statement ​
Problem Statement
Create a numeric vector of student exam scores. Write a single line of code that evaluates these scores and outputs "Pass" for any score 50 or above, and "Fail" for any score below 50.
Source Code ​
Printing the code
To print this file, open it on GitHub and click Raw before printing, or use the Download Raw button above and print directly from that page.
r
# Author: Amit Dutta (amitdutta4255@gmail.com) | Date: 20 Mar 2026
# Repo: https://github.com/notamitgamer/bsc
# License: MIT
# Create a numeric vector of student exam scores.
# Write a single line of code that evaluates these scores and
# outputs "Pass" for any score 50 or above, and "Fail" for any score below 50.
score <- c(45, 26, 89, 21, 75, 99, 13, 68, 85)
ifelse(score < 50, "Fail", "Pass")1
2
3
4
5
6
7
8
9
10
11
2
3
4
5
6
7
8
9
10
11