Practice Real Company Assessment Patterns • Latest 2025–2026 Mock Tests

Programming Exercises

Write an R program to check if a number is even or odd.

Easy

Problem Statement

Write an R program to check if a number is even or odd.

Sample Input

Number: 7

Sample Output

7 is odd

Limits

Time: 2s · Memory: 256 MB

Code Editor
00:00
# Predefined structure num <- 7 if (num %% 2 == 0) { print(paste(num, "is even")) } else { print(paste(num, "is odd"))}
Log in or sign up to run or submit your code.Log inSign up
Input
Number: 7
Expected Output
7 is odd