Quantcast
Viewing latest article 8
Browse Latest Browse All 34

Find the binary equivalent of a number

I have set up a function that acts like the first 8 digits of binary. Im trying assign each value in the binary code with its decimal equivalent. Look below too see what im trying to do. verlistset[0,0,0,0,0,0,0,0,0] verlistset[1,0,0,0,0,0,0,0,1] verlistset[0,1,0,0,0,0,0,0,2] verlistset[1,1,0,0,0,0,0,0,3] verlistset[0,0,1,0,0,0,0,0,4] verlistset[1,0,1,0,0,0,0,0,5] //...247 lines later... verlistset[0,1,1,1,1,1,1,1,254] verlistset[1,1,1,1,1,1,1,1,255] This is very inconvenient, because it would require adding 256 lines of code, which would take forever to type and take up a lot of space. What I'm asking is for help to do this faster. My thoughts so far is to set up a loop like this: for(i=0;i<256;i+=1){ x1= //somthing x2= //somthing x3= //somthing x4= //somthing x5= //somthing x6= //somthing x7= //somthing x8= //somthing verlistset[x1,x2,x3,x4,x5,x6,x7,x8,i] } But I have no Idea how to find the "somthing" value in the code above. Does anyone know how to help?

Viewing latest article 8
Browse Latest Browse All 34

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>