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

Write a function whose job is to output some sequence of \"interesting\" #\'s. T

ID: 3557676 • Letter: W

Question

Write a function whose job is to output some sequence of "interesting" #'s. The numbers should be separated from one another somehow so they don't all run together. This function may need to call another function, where the second function determines whether a number is interesting or not.

The args designate the range [lo, hi]. If lo > hi, then that designates the empty range (no numbers), in which case outputA returns without outputting any numbers. Otherwise, outputA outputs all the numbers in the range that are interesting.

For this problem (A), let's say all numbers are interesting, so we'll output all the numbers in the range.

For example, if main says

            outputA( 5, 10 );

then outputA will output

            5 6 7 8 9 10

For another example, if main says

            outputA( 10, 5 );

then outputA won't output any numbers at all.

Explanation / Answer

int outputA(int num1,num2)

{

if(num1>num2)

return 0;

else

{

for(i=num1;i<=num2;i++)

printf("%d ",i);

}

return 0;

}

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