Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- while(number>0) //Until the number is zero keep running the loop
- {
- rev_number*=10; //Multiply by 10 and keep adding remainders until you reach zero
- rev_number+=number%10; //Add the remainder to the rev_number variable
- number/=10; //Divide the number to be reversed by 10
- }
- Make sure you change the variable names but not the order of the operation. Otherwise you'll fuck shit up
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement