suresh34 suresh34
  • 17-07-2018
  • Computers and Technology
contestada

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

help me to know all the syntex of programming

Respuesta :

Ongly
Ongly Ongly
  • 17-07-2018

// 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)>

Answer Link

Otras preguntas

solve the simultaneous equation 5x+2y=114x-3y=18
Determine the equation of g(x) that results from translating the function f(x)=x^2+9 upward 10 units.
Put brackets in the calculation below to make it correct. 15 - 4 x 2 + 1 = 3
25-[2+5y-3(y+2)]=-3(2y-5)-[5(y-1)-3y+3]
Who was Lancelot? How did he fit into the Arthurian legends?
This popular political pamphlet is considered the origins of the communist system of government.  AnswerCapitalCommunist ManifestoWealth of Nationsnone of the a
explain why x and 4x -10 are factors of the expression x(4x-10)^ rather than terms of the expression . what are the terms of the factor 4x-10?
what is 6=hj+k for j
how do i answer 4+3 x 2 to the third power + 5 to the second power
What Is 0.15 on the number line