Wrong Answer
Input and output matches. Why is it wrong?
why did you use this code?
if(strlen(s) <= 6) {
if the string had more than 6 characters it would be regarded as not hex decimal and display "null"
strlen
0xABCDEF'\n' will return 7.
0xABCDEF(EOF) will return 6.
I was trying to write strlen that is more than 6,because hex decimal is 0x13a'\n' returns 6 and I think 0xABCDEF(EOF) returns 8
Ah, sorry.
0xABCDEF'\n' will return 9.
0xABCDEF(EOF) will return 8
and both data are hexadecimal. and your code will say they are "null"
if input is 0xABCDEF.
you must print 11259375, not null.
but the Sample Output says it should be displayed as null
look carefully.
sample input is 0XABCDEFG. not 0XABCDEF
AND. I can SURELY say that, the length of string doesn't matter to decide that string is hexadecimal or not.
Extreme example, 0x981629846137952794861A93746127936912763491 is hexadecimal. and 0xx is not hexadecimal.
Still do you want to use this code? if(strlen(s) <= 6) {
I removed the if function that checked for the string length but i am still getting a wrong answer