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
Snowcat [4.5K]
3 years ago
13

Given a variable n refers to a positive int value, use two additional variables, k and total to write a for loop to compute the

sum of the cubes of the first n counting numbers, and store this value in total. thus your code should put 1*1*1 + 2*2*2 + 3*3*3 +... + n*n*n into total. use no variables other than n, k, and total.
Computers and Technology
1 answer:
maksim [4K]3 years ago
5 0
You could do it like this (example for n=5).

int n = 5;
int total = 0;
for (int k = 1; k <= n; k++) total += k*k*k;

You might be interested in
1) Draw an activity diagram according to the below flow of event:
stiv31 [10]

Answer:

Yyyyttttrrttyuynynnyj6jj

6 0
3 years ago
Smartphones combine the features of which two types of devices?
tankabanditka [31]
Idunno if you got the answer to this question or if I'm too late, feel free to message me if I'm not!
6 0
3 years ago
Read 2 more answers
To guarantee that the member variables of a class are initialized, you use ____.
Leya [2.2K]
A constructor, member initialization lists and also the default member initializer. Here you see all three (in reality you choose one construct per variable).

class A
{
  public:
    int x = 0;

   A() : x(1)
   {
      x = 2;
   }
};
8 0
3 years ago
Write a C++ code that will read a line of text and echo the line with all uppercase letters deleted. Assume the maximum length o
andriy [413]

Answer:

#include<bits/stdc++.h>

using namespace std;

int main()

{

   string st;

   getline(cin,st);

   int i=0;

   while(i<st.length())

   {

       if(isupper(st[i]))

       {

           st.erase(st.begin()+i);

           continue;

       }

       i++;

   }

   cout<<st<<endl;

   return 0;

}

Explanation:

I have included the file bits/stdc++.h which include almost most of the header files necessary.

For taking the input as a string line getline is used.

For checking the upper case isupper() function is used. cctype header file contains this function.

For deleting the character erase function is used.

6 0
3 years ago
Presentations are used to communicate______ or to help persuade someone of a new idea. A good presentation will contain a mix of
kvv77 [185]
Just quizlet it believe me it will help 100%
7 0
3 years ago
Other questions:
  • You need a version of usb technology that will support older usb devices, of which you have many, as well as newer ones. what wo
    12·1 answer
  • Different video files and ______ can cause compatibility issues to arise between computer systems.
    8·1 answer
  • a rule that states each foreign key value must match a primary key value in the other relation is called the
    5·1 answer
  • What is a close syllable
    5·2 answers
  • In the space provided, analyze the pros and cons of becoming a member of an artistic guild. Your answer should be at least 150 w
    12·1 answer
  • SOMEONE HELP PLEASE ​
    5·1 answer
  • Project 15A - Math Application
    10·1 answer
  • On which tab are the print commands in Excel 2016 accessed?
    7·2 answers
  • Type (dog, cat, budgie, lizard, horse, etc.) Create a class that keeps track of the attributes above for pet records at the anim
    7·1 answer
  • You are the Emergency Management Director of a small island nation. Your nation has come under Cyber-attack and the attackers ha
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!