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
Write an expression that computes the integer average of the int variables exam1 and exam2 (both declared and assigned values).
Minchanka [31]

Answer:

#include <iostream>

using namespace std;

int main()

{

   int exam1 = 70;

   int exam2 = 85;

   int examAverage;

   examAverage = (exam1+exam2)/2;

   cout <<"The Average of Exam1 and Exam2 is: "<<examAverage<<endl;

   return 0;

}

Explanation:

Using the C++, we declare the three variables all of type

exam1

exam2 and

examAverage

We assign initial values of 70 and 85 to exam1 and exam2 respectively

7 0
3 years ago
About.com is considered a (an):
Andrei [34K]
About. com that changed its name recently to dotdash is basically a subject directory. It is a colection of blogs articles about various general intrests of writers. Most of the information it contains is not vetted and thus does not qualify as reference point.
7 0
3 years ago
Please help me with opinions, ideas, any websites that would help, or chart, article, video, or podcast to help support your pos
valina [46]

Answer:

Check explanation.

Explanation:

So, i will be going supporting positive effect of how the reshaping of of the media has affected the film industry. Since brainly do not support me to include links to websites and videos I will only be sharing my opinions on the subject.

One of the ways the media is been reshaped is through the platform known as the Social Networking Sites. This platform has helped people to create an account with them, create content on their sites and share this content. With the development of this platform the film industry can put their content on this platform and show it to the world. On platforms like this, the films can be viewed and shared to many individuals.

These Platforms are been employed by film makers/industry to disseminate their content and also for the generation of revenue.

7 0
3 years ago
24. A key on a keyboard of a computer
ira [324]

Answer:

Its A

Explanation:

.................

5 0
3 years ago
What are the three fundamental features of anobject-oriented programming language?
hjlf

Answer:

  1. Inheritance
  2. Data abstraction or Data encapsulation
  3. Polymorphism.

Explanation:

The three fundamental features of an object oriented programming language are written above.

1. Inheritance:It is the mechanism when a class acquires the properties of some other class.The class which acquires the properties is called the child class and the class from which properties are inherited is called the base class.

2. Data encapsulation is clubbing different types of data in one place.That what class does .It can contain different data types in one place and those variables can be public ,private or protected.

3.Polymorphism it the property when an entity is processed in more than one form.Either be it run time or compile time polymorphism .

6 0
3 years ago
Other questions:
  • Which payment type is best if you are trying to sick to a budget?
    15·1 answer
  • A(n) ____ is a user interface that allows users to interact with graphical objects and pointing devices.
    13·1 answer
  • In this website/app what are the points for?
    7·1 answer
  • It's better to create tables just by starting typing in the data that you want the table to store. There is no need to name fiel
    6·1 answer
  • Three uses for Auto Formatting in Word 2016.
    5·1 answer
  • More recent GPU families such as Fermi and Kepler have adopted CPU-style virtual memory architecture with a____________-bit virt
    8·1 answer
  • Which of the following is not true about search engine advertising?
    15·1 answer
  • To prepare a data character for transmission, a ____ bit is added to the beginning of the character and informs the receiver tha
    11·1 answer
  • Name a piece of software you often use where it is easy to produce an error. Explain ways you could improve the interface to bet
    5·1 answer
  • Write a program that inputs numbers and keeps a running sum. When the sum is greater than 100, output the sum as well as the cou
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!