Computer Science, asked by saniafarah82, 3 months ago

write a program :
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀​

Attachments:

Answers

Answered by Anonymous
73

Answer:

import java.util.Scanner;

public class Sum_Series

{

    public static void main(String[] args)

    {

        Scanner sc = new Scanner(System.in);

        System.out.print("Enter a number: ");

        int n = sc.nextInt();

       

        System.out.println();

       

        int k=1;

        int sum=0;

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

        {

            k=i;

            sum=0;

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

            {

                sum += j;

                if(sum==n)

                {

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

                    {

                        System.out.print(z+"+");

                    }

                    System.out.print(j);

                    System.out.println();

                    break;

                }

            }

        }

    }

}

Answered by Sciencelover828333
2

Here is your answer.

Explanation:

HOPE IT HELP'S...........

Attachments:
Similar questions