00:01
Hello student, here the problem is 5 digit number is given to us and i have to reverse this number with the help of division and modulus operator.
00:12
So here reverse the 5 digit number which is integer type and using division and modulus operators.
00:19
So here we can extract each digit from the input number and construct the reverse number by appending the digit in the reverse order.
00:29
So here is a c+ + code given below.
00:32
So here is a c+ + code.
00:35
Here i have included the file iostream and here i have taken the function int main and here i have taken the unsigned int num and reverse equal to zero.
00:45
So reverse will give me the result at the starting it is equal to zero.
00:50
Now input a 5 digit unsigned integer.
00:53
So here with the help of standard out now enter a 5 digit number.
00:58
Now with the help of a standard in read that number.
01:02
So i have taken the range the number must be between 10 ,000 and 999 ,999.
01:14
So here if number is greater than 10 ,000 and number is here less than this.
01:20
So number means number will be in between this range 10 ,000 and here 999 ,999.
01:29
So number must be in this range.
01:31
So if number is greater than zero, so if the number which i am interested in reversing that must be the positive integer number.
01:40
So here if number is greater than zero extract the last digit.
01:44
Now i have to reverse the number.
01:46
So here first my task will be to extract the last digit.
01:50
Suppose i am taking here the number is equal to 1, 3, 5, 7, 9.
01:56
So here how i will extract i have to calculate its remainder.
02:02
So by dividing 10 my remainder will come 9...