2. Loop and Input a) Request two numbers, n1 and n2 from the console. b) n1 and n2 can be any integer value. c) Use a while loop to horizontally print n1 to n2 with increment by 1 if n1 is smaller than n2. d) Use a for loop to horizontally print n1 to n2 with decrement by 1 if n1 is greater than n2. e) Print a message, “n1 = n2" if n1 is equal to n2.

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter5: Repetition Statements
Section5.6: Nested Loops
Problem 1E: (Misc. application) Four experiments are performed, and each experiment has six test results. The...
icon
Related questions
Question

Need help with python code

2. Loop and Input
a) Request two numbers, n1 and n2 from the console.
b) nl and n2 can be any integer value.
c) Use a while loop to horizontally print n1 to n2 with increment by 1 if n1 is smaller than n2.
d) Use a for loop to horizontally print n1 to n2 with decrement by 1 if n1 is greater than n2.
e) Print a message, "nl = n2" if n1 is equal to n2.
Output Example 1:
Output Example 2:
Output Example 3:
Enter a number n1: 1
Enter a number n2: 11
Enter a number n1: 11
Enter a number n2: 1
Enter a number n1: 10
Enter a number n2: 10
112 131415 161718 19 110:11
11:1019 18:716 151413 1211
ni
= n2
Transcribed Image Text:2. Loop and Input a) Request two numbers, n1 and n2 from the console. b) nl and n2 can be any integer value. c) Use a while loop to horizontally print n1 to n2 with increment by 1 if n1 is smaller than n2. d) Use a for loop to horizontally print n1 to n2 with decrement by 1 if n1 is greater than n2. e) Print a message, "nl = n2" if n1 is equal to n2. Output Example 1: Output Example 2: Output Example 3: Enter a number n1: 1 Enter a number n2: 11 Enter a number n1: 11 Enter a number n2: 1 Enter a number n1: 10 Enter a number n2: 10 112 131415 161718 19 110:11 11:1019 18:716 151413 1211 ni = n2
Submit
1. Loop and Input
a) Request the lower bound, lower and the upper bound, upper from the console.
b) Request an increment value incVal from the console.
c) Use a while loop to increment from lower to upper by increments of incVal such as 0 3 69 12 given lower of 0
and
upper of 12 and increment of 3.
d) Use a while loop to vertically print all values in between each increment.
e) Use a for loop to vertically print all values in between each increment.
Output Example:
USING WHILE LOOP
USING FOR LOOP
Enter the lower bound: 5
Enter the lower bound: 5
Enter the upper bound: 55
Enter the upper bound: 15
Enter a number to increment by: 10
Enter a number to increment by: 5
25
35
10
15
55
5123 45
Transcribed Image Text:Submit 1. Loop and Input a) Request the lower bound, lower and the upper bound, upper from the console. b) Request an increment value incVal from the console. c) Use a while loop to increment from lower to upper by increments of incVal such as 0 3 69 12 given lower of 0 and upper of 12 and increment of 3. d) Use a while loop to vertically print all values in between each increment. e) Use a for loop to vertically print all values in between each increment. Output Example: USING WHILE LOOP USING FOR LOOP Enter the lower bound: 5 Enter the lower bound: 5 Enter the upper bound: 55 Enter the upper bound: 15 Enter a number to increment by: 10 Enter a number to increment by: 5 25 35 10 15 55 5123 45
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 2 images

Blurred answer
Knowledge Booster
Function Arguments
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
Programming with Microsoft Visual Basic 2017
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:
9781337102124
Author:
Diane Zak
Publisher:
Cengage Learning