Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

C++ Write a program that uses while loops to perform the following steps: a. pro

ID: 3542326 • Letter: C

Question

C++

Write a program that uses while loops to perform the following steps:

a. prompt the user to input two integers: firstNum and secondNum

b. Output all odd numbers between firstNum and secondNum.

c. Output the sum of all even numbers between firstNum and secondNum.

d. Output the number and their squares between 1 and 10

e. Output the sum of the square of the odd numbers between firstNum and secondNum.

f. Output all uppercase letters.

I NEED HELP WITH 'F' AND I NEED MY CODE CHECKED TO MAKE SURE EVERYTHING IS CORRECT. IF YOU COULD PLEASE POST YOUR ANSWER WITH ALL THE CODE NEEDED FOR THIS QUESTION SO I KNOW WHERE TO PLACE EVERYTHING I WOULD APPRECIATE IT. THANKS.

THIS IS WHAT I HAVE SO FAR

#include<iostream>
using namespace std;

int main()

{
  int i,sum=0,sqsum=0, firstnum=1,secondnum=0;
char ch;

while(!(firstnum<secondnum))

{
  cout<<"Enter starting number: ";
cin>>firstnum;
cout<<"Enter ending number(must be > startingnumber): ";
cin>>secondnum;
}
i=firstnum;
cout<<"The odd numbers between "<<firstnum<<" and"<<secondnum<<" are: ";
while(i<=secondnum)
{
  if(i%2==0)
sum+=i; //add evennumbers
else
{
  cout<<i <<""; //print odd numbers
sqsum=sqsum+i*i; //and sum there squares
}
i++;
}
cout<<" The sum of the even numbers is:"<<sum<<endl<<endl;
cout<<"The sum of squares the odd numbers is:"<<sqsum<<endl;

i=1;
cout<<" Number Square ";
while(i<=10)
{
  cout<<" "<<i<<" "<<i*i<<endl;
i++;
}

system("pause");



return 0;


}

Explanation / Answer

#include<iostream>
using namespace std;

int main()

{
int i,sum=0,sqsum=0, firstnum=1,secondnum=0;
char ch;
while(!(firstnum<secondnum))

{
cout<<"Enter starting number: ";
cin>>firstnum;
cout<<"Enter ending number(must be > startingnumber): ";
cin>>secondnum;
}
i=firstnum;
cout<<"The odd numbers between "<<firstnum<<" and"<<secondnum<<" are: ";
while(i<=secondnum)
{
if(i%2==0)
sum+=i; //add evennumbers
else
{
cout<<i <<" "; //print odd numbers
sqsum=sqsum+i*i; //and sum there squares
}
i++;
}
cout<<" The sum of the even numbers is:"<<sum<<endl<<endl;
cout<<"The sum of squares the odd numbers is:"<<sqsum<<endl;

i=1;
cout<<" Number Square ";
while(i<=10)
{
cout<<" "<<i<<" "<<i*i<<endl;
i++;
}



cout << endl << " Uppercase Letters are: " << endl;
i = 65;
while(i <= 90){
    char x = i++;
    cout << x << " ";
}


//system("pause");
return 0;


}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote