Question: In this activity you will write the C code necessary for reversing a four digit integer. For example, if you have the integer 2101, the

In this activity you will write the C code necessary for reversing a four digit integer. For example, if you have the integer 2101, the result should be 1012. Your final result should be held in a single variable (e.g., selecting out the individual digits is insufficient, you must also recombine them in reverse order). HINT 1: What position do each of the digits occupy?

HINT 2: Create four variables called ones, tens, hundreds, and thousands.

HINT 3: The modulus operator might be helpful for selecting the digits in the ones, tens, hundreds, and thousands positions (but you don't have to use it).

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!