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

Choose the best description of ABC and RST. WILL CHOOSE BRAINLIEST
Which of the following statements is true? A. Fewer people are interested in news since the creation of the Internet. B. The Internet has expanded the selection
what are the contributing factors that lead to Gender Based Violence
What's the answer to 0.02x + 0.1 (6000) = 0.08 (x + 6000)
You are reviewing the capital structure of your business. You find that your business is financed with 70% cash and 30% debt. Your required rate of return for y
What is the equation for the graph shown?
Question 5 of 10 Which of the following is most likely the next step in the series?
what are the feature of novel wuthering Heights?​
Help!Populations of which taxa are likely to benefit if the numbers of voles and mice increased?
In the figure below, ZAPE and ZEPD are congruent. What is the arc measure of major arc BAD on circle P in degrees?