Question: 1 7 . 2 1 PRACTICE: Loops ( for ) * : Output sequence ( 1 ) Given an integer n , write a for
PRACTICE: Loops for: Output sequence
Given an integer n write a for loop that outputs the numbers from n to n Assume n is nonnegative. End the sequence with a newline.
Enter an integer:
Sequence:
If n is negative, treat as the absolute value. So n of is the same as n of Hint: Use an if statement before the for loop, to compute the absolute value of n
Enter an integer:
Sequence:
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
