Please implement the following problem in basic C++ code and include detailed co
ID: 3885530 • Letter: P
Question
Please implement the following problem in basic C++ code and include detailed comments so that I am able to understand the processes for the solution. Thanks in advance.
Write a program that uses for loops performing the following steps: A. Prompt the user to input two integers: first Num and secondNum (firstNum must be less than secondNum B. Output the numbers between (inclusive) first Num and secondNum C. Output the sum of the numbers between (inclusive) firstNum and secondNum. D. Output all odd numbers between (exclusive) firstNum and secondNum Match the output of the examples below. Example 1: Enter two space separated numbers: 5 13 5 67 8 9 10 11 12 13 Sum is: 81 7 9 11Explanation / Answer
#include <iostream>
using namespace std;
int main() {
int firstNum,secondNum,i,sum=0;
cout<<"Enter two space separated numbers: "<<endl;
cin >> firstNum;
cin >>secondNum;
if(firstNum<secondNum)
{
for(i=firstNum;i<=secondNum;i++)
{
cout <<i <<" ";
}
cout<<endl<<"Sum is: ";
for(i=firstNum;i<=secondNum;i++)
{
sum+=i;
}
cout<<sum<<endl;
for(i=++firstNum;i<secondNum;i++)
{
if(!(i%2==0))
cout<<i <<" ";
}
}
return 0;
}