Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Disclaimer: The creator of 'C# Shell (C# Offline Compiler)' is in no way responsible for the code posted by any user.
- using System;
- using System.IO;
- using System.Linq;
- using System.Collections.Generic;
- namespace CSharp_Shell
- {
- public class Program
- {
- public static void Main()
- {
- var array = new int[] { 5, 0, 4, 1, 2 };
- for (int i = 0; i < array.Length; i++)
- //while (array.Length > 1)
- {
- var newarr = new int[array.Length - 1];
- for (int j = 0; j < newarr.Length; j++)
- {
- newarr[j] = array[j] + array[j + 1];
- }
- array = newarr;
- }
- foreach (var item in array)
- {
- Console.Write(item);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement