How to write a function that uses nested loops to count in binary from 00000000 to 11111111 in R

Viewed 98

how do I write a code for the above question using nested loops? The first few numbers are as follows: 00000000, 00000001, 00000010, 00000011

yes, this is homework as you can see, i have no idea how to start Q2a<-function(x)

{for (j in 0:1)
   {for (i in 0:1)
     {x=10*j +1
    print(x)}
}
  }
0 Answers
Related