SarthakKeshari / CPP-Questions-and-Solutions

This repository aims to solve and create new problems from different spheres of coding. A path to help students to get access to solutions and discuss their doubts.
MIT License
47 stars 132 forks source link

ReverseInteger #499

Closed itsooof closed 2 years ago

itsooof commented 2 years ago

Choose your form and fill it -

1. Form 1(C++ Solution contributors)

2. Form 2(C++ Documentation Contributors)


1) Form 1

Issue Id you have worked upon -

490

Briefly explain your program logic -

However, if the number is large such that the reverse overflows, the output is some garbage value. If we run the code above with input as any large number say 1000000045, then the output is some garbage value like 1105032705 or any other garbage value. This code is for the reverse the digits of integer values There's no need for any data type other than int. Just make sure when there's an operation that increases a number, reversing the operation should give you the previous number. Otherwise, there's overflow.

Screenshots(Attach 2 screenshots of your own input and output) -

image image


Checklist:

Eg - If your code follow the below guidelines. Kindly change [] to [x]

All the conditions should be fulfilled for considering your code for merging -