Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- namespace ConsoleApplication1
- {
- class Program
- {
- static void Main(string[] args)
- {
- int s, i, j, n, l = 0;
- int[,] a;
- n = int.Parse(Console.ReadLine());
- a = new int[100,100];
- for (i = 1; i <= n / 2; i++) {
- j = i;
- int[] v = new int[100];
- s = 0;
- while (s < n) {
- s += j;
- v[j-i+1] = j;
- j++;
- }
- if (s == n) {
- for (int k = 1; k <= j - i + 1; k++)
- a[l, k] = v[k];
- l++;
- }
- }
- for (i = 0; i < l; i++) {
- j = 1;
- while (a[i, j] != 0) {
- Console.Write(a[i, j] + " ");
- j++;
- }
- Console.WriteLine();
- }
- Console.ReadLine();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement