+ 1

decimal to hexa and binary

plz tell why the hell that question mark symbol is coming before hexa in output.like input 23 then number in hexa will show ?17. https://code.sololearn.com/c8cql1kkNvq6/?ref=app

12th Jan 2022, 12:45 PM
gaurav kumar
gaurav kumar - avatar
7 odpowiedzi
13th Jan 2022, 2:35 AM
gaurav kumar
gaurav kumar - avatar
+ 4
Line 19: Decrease <y> before loop begins. <y> was one char ahead. Did you know we can print numbers in hexadecimal by using %x format specifier? Your binary result was not corect also because of similar issue, you need to decrease <x> before loop begins.
12th Jan 2022, 1:58 PM
Ipang
+ 2
Ipang thanks bro u are awesome
12th Jan 2022, 2:05 PM
gaurav kumar
gaurav kumar - avatar
+ 2
Ipang is there any format specifier for binary bro
12th Jan 2022, 2:19 PM
gaurav kumar
gaurav kumar - avatar
+ 1
No bro, not that I know of ...
12th Jan 2022, 5:43 PM
Ipang
0
Looks like its typecasting the int as a char, formatting should help
12th Jan 2022, 1:33 PM
AnonyMouse
AnonyMouse - avatar
0
there is little error Ipang in your answer.only by putting x-- in starting of loop we cant get right output.see the right code i have written. thanks man for answering.
13th Jan 2022, 2:38 AM
gaurav kumar
gaurav kumar - avatar