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

Write a program that calls a function digit(): int digit (int n, int k) This fun

ID: 3613022 • Letter: W

Question

Write a program that calls a function digit():

int digit (int n, int k)

This function returns the k thdigit of the positive integer n. For example, ifn is the integer 29415, then call digit (n, 0)would return the digit 5, and the call digit (n ,2) wouldreturn the digit 4. Note that the digits are numbered from right toleft beginning with the “zeroth” digit.

Sample output1:

    Enter a positive integer :87654

    Enter the digit number :4

    Digit number 4 of 87654 is8

    Press any key tocontinue

Sample output2:

    Enter a positive integer :87654

    Enter the digit number :2

    Digit number 2 of 87654 is6

    Press any key tocontinue

Explanation / Answer

please rate - thanks #include using namespace std; int digit(int,int); int main() {int num,position; coutnum; coutposition; cout
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