Monday, November 18
Reverse any Integer without strings
13:07
By
Unknown
cppQA
,
Reverse any number
,
reverse number in c++
,
Reverse using only single loop
6
comments
It seems now are a stronger community to write generalized programs for FAST NU as well :)
I am posting a program below which reverses any number with just 1 while loop.
See if it works :P
PS please if you copy this or get inspired from this post for your blog then mention us in the post that will be a great gesture than just being douche 3:)
I am posting a program below which reverses any number with just 1 while loop.
See if it works :P
PS please if you copy this or get inspired from this post for your blog then mention us in the post that will be a great gesture than just being douche 3:)
//Code by Umar Farooq /** * follow us at http://CppQA.blogspot.com * **/ #include <iostream> using namespace std; int main() { int number = 12345678; cout<<"Reverse of number "<<number<<" is "; while(number) { cout<<number%10; number/=10; } return 0; }
i have a working example for you at http://ideone.com/Gfurju #CppQA #blogspot
ReplyDeletewith the increased number of posts i thing we need a redesign :P
ReplyDeleteit's so simple and easy........thanks sir
ReplyDeletehow ????
ReplyDeleteA Big Salute Sir ,,,, ,cuz I have been doing it with another logic ,,,, nd it was just limited to three or digits ,,,, (y)
ReplyDelete@Mahin Malik has a great innovation of converting it to a palindrome program. who can do it?
ReplyDeletepost a reply here or on facebook :)