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
2 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]2 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
Any fact or set of facts, such as the words in a letter to a friend or the notes in a song, can become computer ____.
Alina [70]

I think the answer is... data

3 0
3 years ago
A customer comes into a grocery store and buys 8 items. Write a PYTHON program that prompts the user for the name of the item AN
Dmitrij [34]

Answer:

name = []

price = []

for i in range(0,8):

item_name = input('name of item')

item_price = input('price of item')

name.append(item_name)

price.append(item_price)

for i in range(0, 8):

print(name[i], '_____', price[i])

Explanation:

Python code

Using the snippet Given :

Apples 2.10

Hamburger 3.25

Milk 3.49

Sugar 1.99

Bread 1.76

Deli Turkey 7.99

Pickles 3.42

Butter 2.79

name = []

price = []

#name and price are two empty lists

for i in range(0,8):

#Allows users to enter 8 different item and price choices

item_name = input('name of item')

item_price = input('price of item')

#user inputs the various item names and prices

#appends each input to the empty list

name.append(item_name)

price.append(item_price)

for i in range(0, 8):

print(name[i], '_____', price[i])

# this prints the name and prices of each item from the list.

3 0
2 years ago
Which of the following is not a language commonly used for web programming?
DerKrebs [107]
The answer would be Assembly language as assembly language is not used for web development, but rather is a low level programming language.

Please mark branliest if this helped!!
7 0
3 years ago
Read 2 more answers
A computer lab is an example of what type of network
alexandr402 [8]

computers i think i dont sounds right to me

4 0
3 years ago
What is number system?<br>​
MrMuchimi

Answer:

A numeral system is a writing system for expressing numbers; that is, a mathematical notation for representing numbers of a given set, using digits or other symbols in a consistent manner. The same sequence of symbols may represent different numbers in different numeral systems.

Explanation:

8 0
2 years ago
Other questions:
  • ________ is the abbreviation for the place in the computer where the programs and data the computer is currently using are store
    8·1 answer
  • Which method of accessing FTP has the most limited capabilities?
    9·2 answers
  • What is TLB for? Why TLB? Given the following number, what is theeffective memory access time?
    11·1 answer
  • C:\windows\system32\drivers\etc\protocol is an example of a file ________. select one:
    5·1 answer
  • The decimal number 3 is ___ in binary the 2s column plus the 1s column.
    11·1 answer
  • having your online class there's a lot of hazards and risk you may encounter while using gadget PC or Laptop whar do you usually
    14·1 answer
  • How is modern technology developed? Explain.
    14·2 answers
  • How many total cells can a worksheet window contain? If columns are labelled alphabetically, what will be the label for the cell
    15·1 answer
  • Write a function max_magnitude() with two integer input parameters that returns the largest magnitude value. Use the function in
    6·1 answer
  • Tinh T = a1*a2*a3*...an<br><br> Giúp em với
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!