Code 7: Technique to form a new number using only odd digits of the number.

Problem Description: 
We have to form a new number using only the odd digits present in the number. 
For example input number = 12345 New formed number = 135. This requires the Digit Formation Technique s=s+r*10^c (10^c is 10 to the power of c) where 's' is the new formed number(initially 0)'r' the extracted digit 'c' a counter starting from 0. We need to extract individual digits and then use the digit formation technique to form the new number. We could also use Reversing Technique to form a number rather than Digit Formation Technique the difference lies in the fact that by using reversing technique the number is reversed that is not is case of digit formation technique, it form a number in the same order.

No comments:

Post a Comment