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
Question #7
Elis [28]
The answer to this question is firewall
4 0
2 years ago
What is cpu?<br>please give me right answer ​
LUCKY_DIMON [66]

Answer:

Explanation:

processor such as intel/amd processors

7 0
2 years ago
Read 2 more answers
A_________is a way for students to keep track of information during research.
Fudgin [204]
Note pad your welcome


4 0
3 years ago
Ok can someone tell me why I can’t do this? I’m trying to put a video as my background but it won’t show up when I go to add vid
hram777 [196]

Answer: money

Explanation:

3 0
2 years ago
You can view the existing Access Control Lists for a set of folders on a Windows system by right-clicking the folder you want to
NikAS [45]

Answer:

And clicking the security tab option.

Explanation:

Lets explain what an object's ACL is. I will use an example to best explain this. Let's suppose that user Bob would want to access a folder in a Windows environment. What supposedly will happen is that Windows will need to determine whether Bob has rights to access the folder or not. In order to do this, an ACE with the security identity of John will be created. These ACEs are the ones that grant John access to the folder and the ACLs of this particular folder that John is trying to access is a list of permissions of everyone who is allowed to access this folder. What this folder will do is the to compare the security identity of John with the folders ACL and determine whether John has Full control of the folder or not.

By right clicking the folder and selecting the security tab, John will be in a position to see a list of the permissions (ACLs) granted to him by the folder.

3 0
2 years ago
Other questions:
  • What are the cause of eye strain during computer usage?
    7·1 answer
  • Computers store temporary Internet files in the Recycle Bin. These files take up space and slow down a computer. Which tool can
    10·1 answer
  • Describe a time when you influenced someone else’s knowledge around technology, whether it be an app, a new gadget, etc. What di
    14·1 answer
  • Using the notation exemplified in following question , list a set of tables and attributes (and identify keys) to represent the
    10·1 answer
  • Frank lives in an area that experiences frequent thunderstorms. What precautionary measure should he adopt?
    5·1 answer
  • Which elements are in the Sort dialog box? Check all that apply.
    9·1 answer
  • Use of multimedia in business sector...​?
    5·1 answer
  • A(n) _____ is a firm that delivers a software application, or access to an application, by charging a usage or subscription fee.
    6·1 answer
  • What is the role of the memory in a computer ​
    11·1 answer
  • A human subject’s photographs show two catchlights in each eye that are unwanted by the photographer. What is the most likely ca
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!