bsc

Comprehensive codebase and cou...
Log | Files | Refs | Activity | README | LICENSE

root / semester_2 / practice / prac_008.cpp

prac_008.cpp (454B)


      1 /* number reverse */
      2 
      3 #include <iostream>
      4 using namespace std;
      5 
      6 class rev {
      7     int inp, a = 0, b = 0;
      8 
      9 public:
     10     void input();
     11     void calc();
     12 };
     13 
     14 void rev::input() {
     15     cout << "enter the number to reverse : ";
     16     cin >> inp;
     17     a = inp;
     18 }
     19 
     20 void rev::calc() {
     21     while (inp != 0) {
     22         a = inp % 10;
     23         b = b * 10 + a;
     24         inp = inp / 10;
     25     }
     26     cout << b;
     27 }
     28 
     29 int main() {
     30     rev z;
     31     z.input();
     32     z.calc();
     33     return 0;
     34 }
© notamitgamer • Site Built: 2026-09-05 01:53:16 UTC • git-mirror commit: c170d72 [view raw info]
Originally created with stagit • modified by notamitgamer
Forked from github.com/notamitgamer/git-mirror