0

Question related to bitwise operator

How we enter...hexadecimal to scanf and.....find even odd using bitwise operator only

26th Jul 2019, 6:23 AM
RS STATUS CLUB
5 odpowiedzi
- 1
Quoted from http://www.cplusplus.com/reference/cstdio/scanf/ "Any number of hexadecimal digits (0-9,a-f,A-F), optionally preceded by 0x or 0X, and all optionally preceded by a sign (+or-)." Don't worry, scanf will do the parsing of input, check whether the input has any hexadecimal digit, and make necessary adjustment on extracting the number. But to be explicit on the hexadecimal input (as written on the link above), you can (optionally) use the 0x prefix, to tell scanf that the input was a hexadecimal value. Hope it clears the doubt : )
26th Jul 2019, 12:23 PM
Ipang
+ 4
You mean to enter a hexadecimal value on a scanf prompt? if so, then you can use %x format specifier on scanf, for example: scanf("%x", &i); Assuming <i> was an integer type variable.
26th Jul 2019, 7:29 AM
Ipang
+ 1
Ipang.. . if we use int data type then how we insert hexadecimal A,B,B5 Because these are also hexadecimal number , and we cant add character type in int data type
26th Jul 2019, 11:44 AM
RS STATUS CLUB
+ 1
Thnx a lot....
26th Jul 2019, 1:55 PM
RS STATUS CLUB
+ 1
RS STATUS CLUB You're welcome, and please don't mark my answer, I think somebody might want to put a correction note on my answer, so I guess we'll wait for that ... : )
26th Jul 2019, 2:26 PM
Ipang