Skip to content

Commit

Permalink
Merge pull request #273 from HarshitAditya27/master
Browse files Browse the repository at this point in the history
Added Reverse num program in C++
  • Loading branch information
rishabhrathore055 authored Oct 1, 2021
2 parents e2c6598 + d86875c commit df9b2f5
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Contributors.html
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,8 @@ <h1 class="animated rubberBand delay-4s">Contributors</h1>
<a class="box-item" href="https://github.com/malburo"><span>Malburo</span></a>
<a class="box-item" href="https://github.com/kingketan9"><span>Abhay Gupta</span></a>
<a class="box-item" href="https://github.com/ishaan-1n"><span>Ishaan</span></a>
<a class="box-item" href="https://github.com/manavg005"><span>Manav Gupta</span></a>
<a class="box-item" href="https://github.com/manavg005"><span>Manav Gupta</span></a>
<a class="box-item" href="https://github.com/HarshitAditya27"><span>Harshit Aditya</span></a>
<!-- Please maintain the alignment... -->


Expand Down
21 changes: 21 additions & 0 deletions Program's_Contributed_By_Contributors/C++_Programs/reversenum.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
//C++ Program to reverse a number

#include <iostream>
using namespace std;

int main() {
int n, reversedNumber = 0, remainder;

cout << "Enter an integer: ";
cin >> n;

while(n != 0) {
remainder = n%10;
reversedNumber = reversedNumber*10 + remainder;
n /= 10;
}

cout << "Reversed Number = " << reversedNumber;

return 0;
}

0 comments on commit df9b2f5

Please sign in to comment.