If you want to start learning the R programming or you have a bit knowledge about R programming, then this tutorial will help you to explore more. In this tutorial, we are going to share a **Odd or Even program in R programming** with an example.

This program will check if the entered number is an Odd number or Even number. First, we divide the input number by 2, if the remainder is 0, then the input number is even number. If the remainder is 1, then the input number is an Odd number.

Try more:

Copy the below code and execute it to see the program output.

1 2 3 4 5 6 | num = as.integer(readline(prompt="Enter a number: ")) if((num %% 2) == 0) { print(paste(num,"is Even Number")) } else { print(paste(num,"is Odd Number")) } |

First try:

Enter a number: 89

89 is Odd Number

Second try:

Enter a number: 42

42 is Even Number

If you like FreeWebMentor and you would like to contribute, you can write an article and mail your article to [email protected] Your article will appear on the FreeWebMentor main page and help other developers.

- Sum of Natural Numbers Using Recursion
- r program for factorial using recursion
- R program to find L.C.M. with the output
- R program to take input from user with the output
- Convert decimal into binary using recursion in R
- R program to check armstrong number
- R program to find the sum of natural numbers
- r practice problems for beginners
- R Program to Check for Leap Year with the output
- How to Find L.C.M in R Programming with example
- R Program to Add Two Vectors with examples
- R Program to Find the Factors of a Number examples
- R Program to Check Prime Number
- R “Hello World” Program

We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.Ok