Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Program 3: te a program to reverse the digits of a positive integer number. For

ID: 3920626 • Letter: P

Question

Program 3: te a program to reverse the digits of a positive integer number. For example, if the statement 8735 is entered, the number displayed should be 5378. Hint: use a while statement and continuously display the units digit of the number by finding the remainder of the number after dividing by 10 until the number becomes 0. Just "cout" the remainder as a chara Wri strip off and cter with no spaces before or after the single digit and at the end, it will look like a number but really be a bunch of separate numbers. For example this code cout

Explanation / Answer

/*

   With 32 bit compilers:

   maximum value of avariable of type int is +2,147,483,647 and minimum is +2,147,483,647
   if we take the type as unsigned int the maximum value is +4,294,967,295 and minimum value
   is 0. The considerations for long int is same as int

   In case the value we are trying to store is more than the allowed value then the
   value stores is wrapped over value. So in case of signed entities any value more than
   the allowed value will make it negative and in case of unsigned value it will again start
   from 0.

*/


#include<iostream>

using namespace std;

int main(){

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

   while (n > 0){
      cout << n % 10;
      n = n/10;
   }
   cout << endl;
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at drjack9650@gmail.com
Chat Now And Get Quote