answer.
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
muminat
2 years ago
6

Write a for loop to print all NUM_VALS elements of array hourlyTemp. Separate elements with a comma and space. Ex: If hourlyTemp

= {90, 92, 94, 95}, print: 90, 92, 94, 95 Your code's output should end with the last element, without a subsequent comma, space, or newline.
Computers and Technology
1 answer:
vlabodo [156]2 years ago
4 0

Answer:

#include <iostream>

using namespace std;

int main() {

   int NUM_VALS;//variable NUM_VALS for the size of the array..

   cout<<"Enter the size of the array"<<endl;

   cin>>NUM_VALS;//taking input the size of the array..

   int hourlyTemp[NUM_VALS]; //declaring array hourlyTemp of size n..

   cout<<"Enter values of the array "<<endl;

   for(int i=0;i<NUM_VALS;i++)

   cin>>hourlyTemp[i];//taking input of hourlyTemp

   for(int i=0;i<NUM_VALS;i++) //for loop for iterating over the array..

   {

       if(i!=NUM_VALS-1)

       cout<<hourlyTemp[i]<<", ";// print statement.

       else

       cout<<hourlyTemp[i];//print statement.

   }

return 0;

}

Explanation:

I have taken NUM_VALS variable for the size of the array hourlyTemp. First i am taking input the size of array form user and after that array elements are also entered by the user.I am iterating over the array using for loop and checking that it is not the last element if it is simply printing it if it is not then printing comma and space also.

You might be interested in
In a single file, you wrote a bike class and used this line of code in the program.
Elza [17]

Answer:

Explanation:

Based on the available options the one that would be correct would be that the code to define your class (beginning with "class bike") must come before the line "bikeA = bike('Acme' 111)." This is because the line of code declaring the object and initializing it needs to be able to grab the information of the class that it is creating an object of. To do this, the class would need to have already been compiled by the program. It is good practice to have each class definitions as its own separate files but this is not a necessity.

5 0
2 years ago
A workgroup database is a(n) _____ database
Step2247 [10]
It is a shared database
8 0
2 years ago
Jorge saw a computer named Watson on the game show Jeopardy and was surprised at how many answers Watson was able to get correct
KiRa [710]

Answer:

The above statement is FALSE

Augmented reality works with sensor based inputs from the real world.

It is an immersive perception of a real-world environment in which objects existing in the real world are augmented by computer-generated perceptual knowledge, often through multiple sensory modalities like visual, auditory, haptic, somatosensory and olfactory.

Based on the above description

8 0
2 years ago
Output each floating-point value with two digits after the decimal point, which can be achieved as follows:
sdas [7]

Answer:

The modified program in Python is as follows:

import math

paint_colors = {'red': 35,'blue': 25,'green': 23}

wall_height = int(input('Enter wall height (feet):\n'))

wall_width = int(input('Enter wall width (feet):\n'))

area = wall_height*wall_width

print('Wall area:',area,'square feet')

paint_needed = area/350.0

print('Paint needed: {:.2f} gallons'.format(paint_needed))

print('Cans needed:',round(paint_needed),'can(s)')

color = input("Choose a color to paint the wall: ")

print("Cost of purchasing", color, "paint: $",paint_colors[color])

Explanation:

The italicized are given from the question [unchanged]

<em>import math</em>

<em> paint_colors = {'red': 35,'blue': 25,'green': 23} </em>

<em>wall_height = int(input('Enter wall height (feet):\n')) </em>

This gets input for width

wall_width = int(input('Enter wall width (feet):\n'))

Calculate the wall area

area = wall_height*wall_width

Print the calculated wall area

print('Wall area:',area,'square feet')

Calculate the amount of paint needed

paint_needed = area/350.0

Print the amount of paint needed to 2 decimal places

print('Paint needed: {:.2f} gallons'.format(paint_needed))

Print the amount of can needed to nearest integer

print('Cans needed:',round(paint_needed),'can(s)')

Prompt user for color of paint [here, we assume the user input is correct]

color = input("Choose a color to paint the wall: ")

Prints the corresponding amount for the color

print("Cost of purchasing", color, "paint: $",paint_colors[color])

3 0
1 year ago
After running the following pseudocode, what will the value of VARIABLE be? 1. Set value of VARIABLE to 5 2. Increase the value
Nutka1998 [239]

Answer:

10

Explanation:

you start with 5       5

you add 3                8

the variable is not odd so skip         8

the variable is even so add 1            9

the variable is odd so add 1              10

10

hope this helps <3

8 0
2 years ago
Other questions:
  • Cathy connected a keyboard, mouse, and printer to her computer through a Bluetooth connection. What type of network has she crea
    10·2 answers
  • Tina reported a safety hazard at her workplace to OSHA. Representatives from OSHA
    5·1 answer
  • 1. PLCs were originally designed as replacements for: a) microcomputers. c) analog controllers. b) relay control panels. d) digi
    6·1 answer
  • Collaboration online increases students' motivation by
    5·2 answers
  • Martha has been appointed as the Data Security Manager of her organization. The company wants her to develop a customized app to
    13·1 answer
  • Ken Olson, president of Digital Equipment Corp. in the late 1970's, Thomas J. Watson, chairman of IBM in the early 1940's, and T
    6·1 answer
  • The Online Shopping system facilitates the customer to view the products, inquire about the product details, and product availab
    8·1 answer
  • A company has offices in Honolulu, Seattle, Ogden, and Dublin, Ireland. There are transmission links between Honolulu and Seattl
    10·1 answer
  • 4. Word Separator:Write a program that accepts as input a sentence in which all of thewords are run together but the first chara
    10·1 answer
  • First, open two separate terminal connections to the same machine, so that you can easily run something in one window and the ot
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!