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

Given the value of num, this functionshould display num with spaces in between.

ID: 3614611 • Letter: G

Question

Given the value of num, this functionshould display num with spaces in between. This functionshould not return any result to the main program.

Given the value of num, this functionshould display the reversed form of num. This function shouldnot return any result to the main program.

Given the value of num, this functionshould return the reversed form of num to the main program. The reversed form must be displayed in the main program.

Example:

                      Enter num: 671235

                      Display with spaces: 6 7 1 2 3 5

                      Reversed num:   532176

                      Reversed num:   532176

Explanation / Answer

please rate - thanks #include #include void displayWithSpaces(int); void reverseNum(int); int reverseNum2(int); int main() {int a; printf("Enter a number: "); scanf("%d",&a); displayWithSpaces(a); reverseNum(a); printf("Reversed: %d ",reverseNum2(a)); getch(); return 0; } void displayWithSpaces(int a) {int b; printf("With spaces: "); b=reverseNum2(a); while(b>0)     {printf("%d ",b%10);     b/=10;      } printf(" "); } void reverseNum(int a) {printf("Reversed: "); while(a>0)     {printf("%d",a%10);     a/=10;      } printf(" "); } int reverseNum2(int a) {int b=0; while(a>0)     {b=b*10+a%10;     a/=10;      } return b; }
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