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
frosja888 [35]
3 years ago
7

Output a table that show the cube of the numbers 1-15 (C++)

Computers and Technology
1 answer:
Rainbow [258]3 years ago
3 0

Answer:

The c++ program to display cube of numbers from 1 to 15 is given below.

#include <iostream>

using namespace std;

int main() {    

   // variables declared and initialized  

   int num = 15, k, cube;    

   cout << " Cubes of numbers from 1 to 15 are shown below " << endl;    

   for( k = 1; k <= num; k++ )

   {

       // cube is calculated for each value of k and displayed

       cube = k * k * k ;

       cout << " \t " << cube << endl;

   }

return 0;

}

 

OUTPUT

Cubes of numbers from 1 to 15 are shown below  

  1

  8

  27

  64

  125

  216

  343

  512

  729

  1000

  1331

  1728

  2197

  2744

  3375

Explanation:

The variables are declared and initialized for loop, cube and for condition in the loop – k, cube, num respectively.

Inside for loop which executes over k, beginning from 1 to 15, cube of each value of k is calculated and displayed. The loop executes 15 times. Hence, cube for numbers from 1 to 15 is displayed after it is calculated.

   for( k = 1; k <= num; k++ )

   {

      cube = k * k * k ;

       cout << " \t " << cube << endl;

   }

In the first execution of the loop, k is initialized to 1 and variable cube contains cube of 1. Hence, 1 is displayed on the screen.

In the second execution, k is incremented by 1 and holds the value 2. The variable cube contains cube of 2, which is calculated, and 8 gets displayed on the screen.

After each execution of the loop, value of k is incremented.

After 15 executions, value of k is incremented by 1 and k holds the value 16. This new value is greater than num. Hence, the loop terminates.

You might be interested in
A computer essentially takes input, processes it, and produces output. Which person developed a machine in the mid-1880s that ac
Korolek [52]

Answer:

The answer to this question is given below in the explanation section. the correct answer is Herman Hollerith.

Explanation:

Charles Babbage (incorrect)

Charles Babbage considers the father of the digital computer. He was a mathematician, philosopher, inventor, and mechanical engineer, Babbage originated the concept of a digital programmable computer. But he died on 18 1, 1871. so, this option is not correct.

John William Mauchly (Incorrect)

John William Mauchly was an American physicist who, along with J. Presper Eckert, designed ENIAC, the first general purpose electronic digital computer, as well as EDVAC, BINAC and UNIVAC I, the first commercial computer made in the United States. But John William Mauchy born on August 30, 1907 and died on January 8, 1980. So, this option is not correct.

Sir John Ambrose Fleming (Incorrect)

Sir John Ambrose Fleming was an English electrical engineer and physicist who invented the first thermionic valve or vacuum tube, designed the radio transmitter with which the first transatlantic radio transmission was made, and also established the right-hand rule used in physics.

Herman Hollerith (correct)      

Herman Hollerith was an American businessman, inventor, and statistician who developed an electromechanical tabulating machine for punched cards to assist in summarizing information and, later, in accounting. This machine is patented in 1884.

6 0
3 years ago
HELP ME PLEASEEEE
GalinKa [24]

Answer:

hey look I don't think anyones doing a full on essay for 5 points

Explanation:

i could for a bit more

8 0
3 years ago
Which of the following is not a type of user account? A. Administrator b. Guest c. Group d. Standard
Arlecino [84]
I've never heard of a group account so I'm going with.
C. Group
5 0
3 years ago
What was the first portable computer called and who made it?
jekas [21]
It was the Osborne 1 made by Adam Osborne in 1981.
6 0
3 years ago
Write an if else statement that assigns 0 to the variable b and assigns 1 to the variable c if the variable a is less than 10. O
brilliants [131]

Answer:

if(a < 10)

{ b = 0; c = 1;}

else

{ b = -99; c = 0;}

Explanation:

4 0
3 years ago
Other questions:
  • What control features will you use in the input screens to aid in data entry? give a specific example of how you will use at lea
    6·1 answer
  • What would you use to compare two date ranges in a report?
    9·1 answer
  • Which of the following is NOT considered a step in the problem solving process. A Try B Discover C Prepare D Define
    12·1 answer
  • To complete this quest, answer the following questions in the submission box below. Make x an array going from 0 to 100 by steps
    15·1 answer
  • Kevin needs to get his data from a database into a text file to send to another group. He needs to _____.
    12·2 answers
  • What are the concerns surrounding 5G cellular networks?​
    6·1 answer
  • Write a C program that uses a while statement to determine and print the largest of 10 numbers input by the user. Your program s
    6·1 answer
  • Write a deffrentiate between inkjet peinter and laser printer​
    8·1 answer
  • Given positive integer n, write a for loop that outputs the even numbers from n down to 0. If n is odd, start with the next lowe
    8·1 answer
  • Computer Hardware can consist of a
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!