// Program 69: Represent a Number as Consecutive Positive Integers import java.util.*; class ConsecutiveSum { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); if (n < 1) { System.out.println("INVALID INPUT"); return; } boolean found = false; for (int start = 1; start < n; start++) { int sum = 0; for (int end = start; sum < n; end++) { sum += end; if (sum == n && end > start) { for (int k = start; k <= end; k++) { System.out.print(k + (k < end ? "+" : "")); } System.out.println(); found = true; break; } } } if (!found) { System.out.println("NO CONSECUTIVE SUM FOUND"); } } }