Computer Science, asked by rimfg3898, 12 days ago

Write a program to find the sum 1+2+3....10

Answers

Answered by coco91
0

Answer:

public class KboatSeriesSum

{

   public static void main(String args[]) {

       int sum = 0;

       for (int i = 1; i <= 10; i++) {

           int p = 1;

           for (int j = 1; j <= i; j++)

               p *= j;

           sum += p;

       }

       System.out.println("Sum = " + sum);

   }

}

Similar questions