Slip 17 - E) Write an R Program to calculate Decimal into binary of a given number.

Solution:

binary_conversion<-function(n){
  if(n>1){
    
    binary_conversion(as.integer(n/2))
  }
  cat(n%%2)
}
binary_conversion(13)

Post a Comment

0 Comments