Skip to content

Commit

Permalink
Reverseint
Browse files Browse the repository at this point in the history
  • Loading branch information
khushimarothi committed Oct 1, 2022
1 parent 2746366 commit 26420fd
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions C++/Reverse_integer.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
//https://leetcode.com/problems/reverse-integer/

#include <bits/stdc++.h>
using namespace std;

int reverse(int x) {
long int reverse=0;
while(x!=0){
int digit=x%10;
reverse=reverse*10+ digit;
x=x/10;
}
return reverse; }
int main(){
int x=2486;
cout<<"Reverse no : "<<reverse(x);
return 0; }


0 comments on commit 26420fd

Please sign in to comment.