Using C++ Write a program that uses for loops to perform the following steps
Types of Loop
Loops are the elements of programming in which a part of code is repeated a particular number of times. Loop executes the series of statements many times till the conditional statement becomes false.
Loops
Any task which is repeated more than one time is called a loop. Basically, loops can be divided into three types as while, do-while and for loop. There are so many programming languages like C, C++, JAVA, PYTHON, and many more where looping statements can be used for repetitive execution.
While Loop
Loop is a feature in the programming language. It helps us to execute a set of instructions regularly. The block of code executes until some conditions provided within that Loop are true.
Using C++ Write a program that uses for loops to perform the following steps
![### Programming Exercise 5-9
#### Instructions
To complete this exercise, follow the steps below:
1. **Input Two Integers**:
Prompt the user to input two integers: `firstNum` and `secondNum`.
- Ensure that `firstNum` is less than `secondNum`.
2. **Output Odd Numbers**:
Output all odd numbers between `firstNum` and `secondNum`.
3. **Sum of Even Numbers**:
Output the sum of all even numbers between `firstNum` and `secondNum`.
4. **Numbers and Their Squares**:
Output the numbers and their squares between 1 and 10.
- Separate the numbers using any amount of spaces.
5. **Sum of Squares of Odd Numbers**:
Output the sum of the square of the odd numbers between `firstNum` and `secondNum`.
6. **Output Uppercase Letters**:
Display all uppercase letters.](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F50f86a9a-dfbf-48fb-a8b1-f37eac08df1e%2Fda558da3-45cf-46b3-9462-443a4f5fa0b5%2Fvajv0g_processed.jpeg&w=3840&q=75)
![**Instructions**
1. Output all odd numbers between `firstNum` and `secondNum`.
2. Output the sum of all even numbers between `firstNum` and `secondNum`.
3. Output the numbers and their squares between 1 and 10.
- Separate the numbers using any amount of spaces.
4. Output the sum of the square of the odd numbers between `firstNum` and `secondNum`.
5. Output all uppercase letters.
**Grading**
When you have completed your program, click the **Submit** button to record your score.](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F50f86a9a-dfbf-48fb-a8b1-f37eac08df1e%2Fda558da3-45cf-46b3-9462-443a4f5fa0b5%2F45y0hbh_processed.jpeg&w=3840&q=75)
![](/static/compass_v2/shared-icons/check-mark.png)
Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 3 images
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
How do I print the Uppercase letters without the commas?
Thank you. It also asks to 'output all uppercase letters' in case 1 and 2.
Test Case 1 has inputs
4
36
Test Case 2 has inputs
987
1001
The pictures I sent is the
![main.cpp
1 #include <iostream>
2
3 using namespace std;
4
5 int main()
6
67891pnvsuuuu
{
210
11
12
13
gº
14
15
18
19
20
21
22
23
24
25
26
int firstNum, secondNum, evenSum = 0, oddSumSquare= 0;
cout<<"ENTER FIRST NUMBER ";
cin>>firstNum;
cout<<"ENTER SECOND NUMBER: ";
+
cin>>secondNum;
cout<<"ODD NUMBER BETWEEN "<<firstNum<<" AND `"<<secondNum<<endl;
while(firstNum<=secondNum) {
if(firstNum%2 != 0) {
oddSumSquare += firstNum*firstNum;
cout<<firstNum<<" ";
}
}
else{
}
evenSum += firstNum;
firstNum++;
cout<<"\nSUM OF ALL EVEN NUMBERS BETWEEN "<<firstNum<<" AND "<<secondNum<<" = "<<evenSum<<endl;
cout<<"PRINT NUMBER AND THEIR SQUARE BETWEEN 1 AND 10"<<endl;
for(int i=1; i <=10; i++) {
cout<<i<<": "<<i*i<<endl;
O
C
▬▬
hp
99+
a
I
W](https://content.bartleby.com/qna-images/question/50f86a9a-dfbf-48fb-a8b1-f37eac08df1e/74086d01-2ec1-4328-b72e-7407f4ac290e/dbhd1hu_thumbnail.jpeg)
![7 int firstNum, secondNum, evenSum = 0, oddSumSquare= 0;
cout<<"ENTER FIRST NUMBER '";
cin>>firstNum;
cout<<"ENTER SECOND NUMBER: ";
cin>>secondNum;
cout<<"ODD NUMBER BETWEEN "<<firstNum<<" AND "<<secondNum<<endl;
while(firstNum<=secondNum) {
if(firstNum%2 != 0) {
oddSumSquare += firstNum*firstNum;
cout<<firstNum<<" ";
BAHARNING
10
12
13
14
16
C
@
26
27
28
29
30
31}
32
}
}
else{
}
evenSum += firstNum;
}
firstNum++;
cout<<"\nSUM OF ALL EVEN NUMBERS BETWEEN "<<firstNum<<" AND "<<secondNum<<" = "<<evenSum<<endl;
cout<<"PRINT NUMBER AND THEIR SQUARE BETWEEN 1 AND 10"<<endl;
for(int i=1; i<=10; i++) {
cout<<i<<" : "<<i*i<<endl;
cout<<"\nSUM OF THE SQUARE OF ALL ODD NUMBERS BETWEEN "<<firstNum<<" AND "<<secondNum<<": "<<oddSumS
return 0;
O
CO
70
Cop
99+
a
W](https://content.bartleby.com/qna-images/question/50f86a9a-dfbf-48fb-a8b1-f37eac08df1e/74086d01-2ec1-4328-b72e-7407f4ac290e/hq6td17_thumbnail.jpeg)
![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
![Starting Out with Python (4th Edition)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
![Starting Out with Python (4th Edition)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
![C How to Program (8th Edition)](https://www.bartleby.com/isbn_cover_images/9780133976892/9780133976892_smallCoverImage.gif)
![Database Systems: Design, Implementation, & Manag…](https://www.bartleby.com/isbn_cover_images/9781337627900/9781337627900_smallCoverImage.gif)
![Programmable Logic Controllers](https://www.bartleby.com/isbn_cover_images/9780073373843/9780073373843_smallCoverImage.gif)