Math, asked by iandancan868, 3 months ago

Express the algorithm to compute the sum of cubes of all numbers from 1 to N in a flowchart(i.e. 13+23+33+……+N3)

Answers

Answered by ns168900
2

13+23+33.......+N3

Input n=1

Answered by itzFaReboy
0

Example:-

  • Input n=1
  • Output=82
  • 13+23+33+13=82

Programme:-

  • 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 = 1;
  • System.out.println(sumOfSeries(n));

}

}

Compile kro...............

Similar questions