Thursday, May 10, 2012

Expression Evaluation: Separate Digits from a Four digits integer number

hello guys!!! Hope, you all are well by the grace of Almighty ALLAH. Today we learn how to separate digits from a four digit integer number.

We can try the following process of separating digits from a integer number:

If the number is 1234, then when we divide it with 10, we will find "4" as the remainder. Then again we divide the number with 10. Then, we will find 123 as quotient. After this, again we divide 123  by 10 and find "3" as the remainder. Then, if we divide 123 with 10, we will find 12 as quotient. After this, when we divide 12 by 10 we will find "2" as remainder. Then when we again divide 12 by 10, we will find "1" as quotient.

Now, "1", "2", "3" & "4" are the separated digits.

Now, we can write C programming code by using this formula. Let's look at the program:

















Thank you all..:)

0 comments:

Post a Comment