1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
dsp73
3 years ago
15

Write a program that uses for loops to perform the following steps: Prompt the user to input two integers: firstNum and secondNu

m (firstNum must be less than secondNum). Output all odd numbers between firstNum and secondNum. Output the sum of all even numbers between firstNum and secondNum. Output the numbers and their squares between 1 and 10. Separate the numbers using any amount of spaces. Output the sum of the square of the odd numbers between firstNum and secondNum. Output all uppercase letters.

Computers and Technology
1 answer:
Artist 52 [7]3 years ago
6 0

Answer:

//Include the required header files.

#include<iostream>

using namespace std;

//Define the main function.

int main()

{

//Define the variables.

int i, sum = 0, sqSum = 0, firstNum = 1, secondNum = 0;

char ch;

//Check for valid input.

while (!(firstNum < secondNum))

{

cout << "Enter starting number: ";

cin >> firstNum;

cout<<"Enter ending number(must be > startingNumber): ";

cin >> secondNum;

}

//Store first number in i

i = firstNum;

//Dispaly the number.

cout << "The odd numbers between " << firstNum

<< " and " << secondNum << " are:\n";

//Iterate between first and second number.

while (i <= secondNum)

{

//Check for even numbers.

//Store the sum

if (i % 2 == 0)

sum = sum + i;

//Print the odd numbers

//Evaluate the square of sum of odd number.

else

{

cout << i << " ";

sqSum = sqSum + i * i;

}

//Increase the value of i.

i++;

}

//Dispaly the sum of even numbers.

cout << "\n\nThe sum of the even numbers is:"

<< sum << endl << endl;

//Dispaly the sum of square of odd number.

cout << "The sum of squares the odd numbers is:"

<< sqSum << endl;

//Set i to 1.

i = 1;

//Dispaly the message.

cout << "\nNumber Square\n";

//Iterate and print number between 1 andd 10

//along with the sum.

while (i <= 10)

{

cout << " " << i << "\t " << i * i << endl;

i++;

}

//USe for visual studio.

system("pause");

//Return the value 0.

return 0;

}

Explanation:

The program code will perform the function listed below using loop.

Prompt the user to input two integers: firstNum and secondNum (firstNum must be less than secondNum). Output all odd numbers between firstNum and secondNum. Output the sum of all even numbers between firstNum and secondNum. Output the numbers and their squares between 1 and 10. Separate the numbers using any amount of spaces. Output the sum of the square of the odd numbers between firstNum and secondNum. Output all uppercase letters.

Check the attachment for its output and program screenshot.

You might be interested in
You conduct an experiment to find the probability of a flipped coin landing on
AleksAgata [21]

Answer:

Experimental probability describes how frequently an event actually occurred in an experiment. So if you tossed a coin 20 times and got heads 8 times, the experimental probability of getting heads would be 8/20, which is the same as 2/5, or 0.4, or 40%.

5 0
2 years ago
Read 2 more answers
When you add an rss feed to hootsuite publisher, posts from blogs and websites you designate will be?
Cloud [144]

All answers are correct.

Source and explanation: certificationanswers.com/en/category/hootsuite-platform/

8 0
3 years ago
Which type of message format is designed to arouse curiosity, not showing the product or delivering quite enough information to
Anarel [89]

The type of message format that is designed to arouse curiosity by not showing the product or delivering quiet enough information to make sense is teaser. This is a way of providing information that is short and in which it does not identify the product or the whole message itself. 

7 0
3 years ago
Within an event-driven program a component from which an event is generated is the ____
mojhsa [17]
The answer is: <span>Source of the Event</span>
7 0
3 years ago
(ATRCKALLB) __________is an input device that contains a movable ball on the top.​
nikitadnepr [17]

Answer:

trackball

Explanation:

A trackball can be seen on a mouse.

3 0
2 years ago
Other questions:
  • Which two technologies support the building of single-page applications?
    11·1 answer
  • In three to five sentences, describe how good e-mail work habits increase workplace efficiency and productivity.
    12·1 answer
  • If you know about 3D printers could you help me fix mine?
    8·1 answer
  • The _____ icon allows the user to improve the brightness, contrast, or sharpness of the picture.
    10·1 answer
  • One purpose of the dual ignition system on an aircraft engine is to provide for?
    7·2 answers
  • How does the Rights Management Services feature help to protect information
    11·1 answer
  • Hat is the purpose of the domain name?
    7·2 answers
  • What can you do to help create a safe online environment?
    8·2 answers
  • Secondary hard drive whats its purpose
    5·1 answer
  • What is meant by reflection?​
    9·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!