In this program, we have to find reverse of a no. For eg:- if number is 27654 then reverse number will be 45672 .
Formula used : -
eg:- no. is 456
456 = 6 + 5*10 + 4*100. this logic is used.
line a = n%10; is used to seperate single digits i.e if no. is 456 then after this line a=6
line n = n/10 is use to decrease the total no. ie if no. is 456 after this line it would be 45 only in n.
So, in this way we reverse a number..

No comments:
Post a Comment
Guys if you think something is wrong or should be edit than please do comment.