fastread homefastrread library fastread menu

R Programming : Convert Decimal into Binary using Recursion

Tutorial by:Maria Ghoste      Date: 2016-06-10 02:31:45

❰ Previous Next ❱

Source Code

# Program to convert decimal
# number into binary number
# using recursive function

binary <- function(n) {

    if(n > 1) {
    cat(n %% 2)


> binary(52)

In this program, we convert decimal number entered by the user into binary using a recursive function. Decimal number is converted into binary by dividing the number successively by 2 and printing the remainder in reverse order.

❰ Previous Next ❱

R Programming

Submit Your Thought, Tutorial, Articls etc.

Submit Your Information India's Number one online promotion website