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
ruslelena [56]
3 years ago
7

Write a programme to find the sum of first three cube number?

Computers and Technology
1 answer:
aleksandrvk [35]3 years ago
7 0

// Simple Java program to find sum of series

// with cubes of first n natural numbers

import java.util.*;

import java.lang.*;

class GFG {

/* Returns the sum of series */

public static int sumOfSeries(int n)

{

int sum = 0;

for (int x = 1; x <= n; x++)

sum += x * x * x;

return sum;

}

// Driver Function

public static void main(String[] args)

{

int n = 5;

System.out.println(sumOfSeries(n));

}

}

// Code Contributed by Mohit Gupta_OMG <(0_o)>

You might be interested in
A person who wants to buy a compact disc (cd) has just enough money to buy one, and chooses cd a instead of cd
bulgar [2K]

If someone who wants to acquire a compact disc (CD) has just sufficient money to buy one, and chooses CD a instead of CD b, then CD B is the opportunity cost.

 

To add, opportunity cost. <span>the loss of potential gain from other alternatives when one alternative is chosen.</span>

7 0
3 years ago
Read 2 more answers
Which is the correct formula to add the values in cells A1 and B1?
arlik [135]
I'm assuming you are referring to Excel. There are a few ways to add A1 and B1.

First you could use '=SUM(A1+B1)'

You could also use '=SUM(A1:B1)' which adds the values of all the cells between A1 and B1, but since they are next to each other, this would work.

You could also use '=SUM(A1,B1)' where you list all the cells you want to add with commas in between.
7 0
3 years ago
Read 2 more answers
Which tool is used to view stars in galaxies far from the Milky Way?
Rom4ik [11]
<span>The tool iused to view stars in galaxies far from the Milky Way is the B. Hubble Space Telescope. This telescope is one of the largest telescopes to be launched in space, and has contributed a vast amount of discoveries and data that are valuable in astronomical research. The telescope is able to capture image intense high-resolution images, capturing entities from large distances.</span>
7 0
3 years ago
Assume that you have an ArrayList variable named a containing 4 elements, and an object named element that is the correct type t
jonny [76]

Answer:

Option (4) is the correct answer.

Explanation:

In Java programming language ,array collection starts from 0 index location and ends in a size-1 index location. So to access the last elements the user needs to use a[Size-1] statement. so to modify the value of the last location of the array the user needs to use "a[size-1]= element;".

But when the user wants to add some new value to the end of the array list collection then he needs to use the statement--

a.add(element); //where add is a function, element is a value and a is a array list object.

Another option is invalid because--

  • Option 1 is not the correct because "a[3]=element;" modify the value of the 3rd element of the array.
  • Option 2 gives a compile-time error because add functions bracts are not closed.
  • Option 3 gives the error because a[4] gives the location of the 5th element of the array but the above question says that a is defined with 4 elements.
7 0
3 years ago
Sarah has to add a picture from her computer file and add a caption to it. Arrange the steps in a correct sequence.
MatroZZZ [7]

Answer:

-Click insert

-Click picture

-Click from file

-Right click the picture

-Select the desired picture and again click Insert

-Click insert caption

-Write the caption and add it

Explanation:

6 0
3 years ago
Other questions:
  • You should use _____ software for writing a letter.
    10·1 answer
  • Think of a game you are familiar with and identify at least three team responsibilities which were required to make the game, on
    5·1 answer
  • Your project must satisfy the following requirements:
    7·1 answer
  • What happens of the gamers dont follow the age ratings
    14·2 answers
  • Where do you place the logical test argument in an JF function formula?
    5·2 answers
  • I prefer a job where I am praise for good performance or I am accountable for results
    13·1 answer
  • Write a program that prompts the user for the name of two files each containing a single line that represents a decimal integerc
    11·1 answer
  • If, when asked for a date of birth, the user enters a future date, this error should be caught by a ________ check.
    8·1 answer
  • A short-range wireless network is called:
    10·1 answer
  • QUESTION 4
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!