I need help in this C Program. Write the function displayExtractedNumbers() that displays the numbers in the given code in nCode based on the digit information nDigitInfo provided. nCode contains numbers merged as one integer, while nDigitInfo indicates the the number of digits of each number in nCode. Assume the following: nCode = 123456789 and nDigitInfo = 4113: The numbers found in nCode are:  1234, 5, 6, and 789. nCode: 1 2 3 4 5 6 7 8 9 nDigit Info ---------- ---------- ----------> 4 1 1 ------- -------> 3 Assume that the following functions are already defined. Use them in your solution. int getReverse (int nNum) returns an integer whose digits are in reverse order of the given positive integer nNum. Examples: getReverse(1234) returns 4321 getReverse(1) returns 1 int get10RaisedToExp (int nExp) returns the value of 10nExp, where nExp is a nonnegative integer. int extractNumber (int nSource, int nDigits) extracts the rightmost digits of nSource based on the given number of digits nDigits, and returns the number in reverse order of digits.  The function returns -1 if it is impossible to extract the number. Examples: extractNumber(12345, 3) returns 543. extractNumber(12, 2) returns 21. extractNumber(123, 4) returns -1. Sample Run- Code: 123876 Digit info: 222 Extracted numbers: 12 38 76 Done int main() int main () { int nCode; int nDigitInfo; printf ("Code: "); scanf ("%d", &nCode); printf ("Digit info: "); scanf ("%d", &nDigitInfo); displayExtractedNumbers (nCode, nDigitInfo); return 0; }int main () { int nCode; int nDigitInfo; printf ("Code: "); scanf ("%d", &nCode); printf ("Digit info: "); scanf ("%d", &nDigitInfo); displayExtractedNumbers (nCode, nDigitInfo); return 0; }

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

I need help in this C Program.

Write the function displayExtractedNumbers() that displays the numbers in the given code in nCode based on the digit information nDigitInfo provided. nCode contains numbers merged as one integer, while nDigitInfo indicates the the number of digits of each number in nCode.

Assume the following: nCode = 123456789 and nDigitInfo = 4113:

The numbers found in nCode are:  123456, and 789.

nCode: 1 2 3 4 5 6 7 8 9
nDigit Info ---------- ---------- ----------> 4 1 1 ------- -------> 3

Assume that the following functions are already defined. Use them in your solution.

  • int getReverse (int nNum)
    • returns an integer whose digits are in reverse order of the given positive integer nNum.
    • Examples:
      • getReverse(1234) returns 4321
      • getReverse(1) returns 1
  • int get10RaisedToExp (int nExp)
    • returns the value of 10nExp, where nExp is a nonnegative integer.
  • int extractNumber (int nSource, int nDigits)
    • extracts the rightmost digits of nSource based on the given number of digits nDigits, and returns the number in reverse order of digits.  The function returns -1 if it is impossible to extract the number.
    • Examples:
      • extractNumber(12345, 3) returns 543.
      • extractNumber(12, 2) returns 21.
      • extractNumber(123, 4) returns -1.

Sample Run-

Code: 123876
Digit info: 222

Extracted numbers:
12
38
76
Done

int main()

int main ()
{
int nCode;
int nDigitInfo;

printf ("Code: ");
scanf ("%d", &nCode);

printf ("Digit info: ");
scanf ("%d", &nDigitInfo);

displayExtractedNumbers (nCode, nDigitInfo);

return 0;
}int main ()
{
int nCode;
int nDigitInfo;

printf ("Code: ");
scanf ("%d", &nCode);

printf ("Digit info: ");
scanf ("%d", &nDigitInfo);

displayExtractedNumbers (nCode, nDigitInfo);

return 0;
}

Expert Solution
steps

Step by step

Solved in 2 steps with 2 images

Blurred answer
Knowledge Booster
Datatypes
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-engineering and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY