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

The question is: Write a function that takes an integer value and returns the nu

ID: 3620518 • Letter: T

Question

The question is: Write a function that takes an integer value and returns the number with its digits reversed. For example, given the number 7631, the function should return 1367.
Modifications:
-prompt the user for an integer between 1 and 10,000 inclusive (from main())
-pass the input value to a function that returns the number with the digits reversed (a call from main() calls your function and passes the value input by the user)
-display the result from main(). Leading zeros can be eliminated. For example, if 2020 is input, the reverse is 0202 but the program may display 202.

(I'm using PuTTy... nano)

Explanation / Answer

#include<stdio.h> #include<conio.h> void reverse(unsigned long int); void main() { unsigned long int no; clrscr(); printf("Enter the number    :"); scanf("%ld",&no); printf(" Number in Reverse order: "); reverse(no); getch(); } void reverse( unsigned long int a) { unsigned long int c,d=10; while (a>0) { c=a%d; printf("%ld",c); a=a/d; } }
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