Re: Sequence items to a single number ? How to achieve ?

new topic     » goto parent     » topic index » view thread      » older message » newer message

This is a somewhat different method

  
 include std/convert.e 
 
 integer d = 13  --your decimal number  
  
 sequence b = {}  
 
 b = reverse(int_to_bits(d)) 
 b = b[find(1,b)..$] 
 
 puts(1,"{")  
 for i = 1 to length(b) do  
    printf(1,"%d",b[i])  
    if i != length(b) then  
        puts(1,",")  
    end if  
 end for  
 puts(1,"}") 
 
 
new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu