Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Programming C++ Exercise 4.1 Exercise 4.1.1. Use the for statement in a program that prints all the numbers from n1 to n2, where n1 and

Programming C++

Exercise 4.1

Exercise 4.1.1. Use the for statement in a program that prints all the numbers from n1 to n2, where n1 and n2 are two numbers specified by the user. (Hint: Youll need to prompt for the two values; then, inside the for statement, initialize i to n1, and use n2 in the loop condition.)

Exercise 4.1.2. Rewrite the example so that it prints all the numbers from n to 1 in reverse order. For example, the user enters 5, and the program prints 5 4 3 2 1. (Hint: In the for loop, initialize i to n, use the condition i >= 1, and subtract 1 from i in the increment step.)

Exercise 4.1.3. Write a program that prints all numbers from 1 to n, but prints only even numbers or only odd numbers. Each number printed will be 2 higher than the last

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Visual Basic6 Database Programming

Authors: John W. Fronckowiak, David J. Helda

1st Edition

0764532545, 978-0764532542

More Books

Students also viewed these Databases questions

Question

Are these written ground rules?

Answered: 1 week ago

Question

Have ground rules been established for the team?

Answered: 1 week ago