Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Reverse num program in C++ #273

Merged
merged 2 commits into from
Oct 1, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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;
}