hi guys, i need help!, how do i extract odd digits from a positive number, example: 1234567 then only 1357 will be extracted out from the value 1234567? I noe can make use of modules % to check for odd and even number however i do not know how to extract the odd value out 1 by 1 from a set of value
rocky86
0
Newbie Poster
Recommended Answers
Jump to PostYou can convert the number to a String then extract every char that is one of '1', '3' etc from that String.
All 4 Replies
JamesCherrill
4,733
Most Valuable Poster
Team Colleague
Featured Poster
rocky86
0
Newbie Poster
JamesCherrill
4,733
Most Valuable Poster
Team Colleague
Featured Poster
kramerd
29
Posting Pro in Training
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.