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
myrzilka [38]
3 years ago
15

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

Computers and Technology
1 answer:
Vladimir79 [104]3 years ago
3 0

Answer:

Explanation:

//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.

Hope this helps!

You might be interested in
Jorge is sending a large image file to a friend as part of a shared classroom project. Which of the following is most likely tru
madreJ [45]

Answer:

D. The image will require fewer bits in order to be represented.

Explanation:

Lossy compression algorithms are typically better than lossless compression algorithms at reducing the number of bits needed to represent a piece of data.

5 0
3 years ago
Should people who download music and movies illegally be punished?
Mrrafil [7]
Opinion wise, I disagree with punishment. 
3 0
3 years ago
Effective online learning method for students
qwelly [4]

Answer: Desire method: This is one of the unique but most effective teaching strategies to grab student attention and...

Active learning: The one sided lecture methods are no more fruitful to get the interest of the new generation...

Cooperative learning: Give them a chance to come out of their seats

Explanation:

4 0
3 years ago
The helping professions all involve_____.
NARA [144]

Answer:

look that up on gogle

filler filler filler filler filler

7 0
3 years ago
Randy is concerned about his company’s data security on the Internet. Because cellular signals are not encrypted, he is concerne
Misha Larkins [42]

Answer:

By using a virtual private network (VPN)

Explanation:

If Randy deploys a virtual private network (VPN), it will give the sales department online privacy since VPN encrypt connections whenever the sales department connects to the company network over the Internet. A VPN for the sales department is very necessary to use over a cellular data signal to ensure the department's overall digital defense, and it also has other uses.

7 0
3 years ago
Other questions:
  • Which step of creating a financial budget involves listing the payroll, rental, and utility costs?
    10·2 answers
  • Consider a multiprocessor CPU scheduling policy. There are 2 options: 1) a singlecommon ready queue of jobs; when a CPU becomes
    8·1 answer
  • Will upvote!
    12·1 answer
  • In which step of web design is storyboarding helpful?
    14·1 answer
  • System inputs and outputs are produced at the end of the: A. systems analysis phase of the SDLC. B. systems planning and selecti
    12·1 answer
  • Let's say that you're the sole IT person in your company, and your boss wants a way to block certain websites from employees. Wh
    6·2 answers
  • Write a program that reads the subtotal and the gratuity rate, then computes the gratuity and total. For example, if the user en
    6·1 answer
  • What is the unemployment rate if the GDP gap is 13.5%?<br><br> A. 6.25%<br> B. 6.75%<br> C. 6.7%
    8·1 answer
  • Adobe Indesign project 4 museum indesign file. The instructions are 70 pages long I cant sit still long enough to read them
    11·1 answer
  • A large retail company hires several new joiners and would like to incorporate Virtual Reality (VR) into their onboarding proces
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!