Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace ConsoleApp2
- {
- class Program
- {
- static void Main(string[] args)
- {
- int[] A = new int[] { -1,3,-3,5,-7,-5,4,-9,4,-3,2,-1,-1,-2,-3,4,5,67,4,6};
- int[] A2 = new int[0];
- for (int i = 0; i < A.Length-1; i++)
- {
- if (A[i] >= 0)
- {
- int[] temp = new int[A2.Length+1];
- for (int z = 0; z < A2.Length; z++)
- {
- temp[z] = A2[z];
- }
- temp[temp.Length-1] = A[i];
- A2 = temp;
- }
- }
- for (int i = 0; i < A.Length -1; i++)
- {
- if (A[i] < 0)
- {
- int[] temp = new int[A2.Length + 1];
- for (int z = 0; z < A2.Length; z++)
- {
- temp[z] = A2[z];
- }
- temp[temp.Length - 1] = A[i];
- A2 = temp;
- }
- }
- for (int i = 0; i < A2.Length-1; i++)
- {
- Console.Write($"{A2[i]} ");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment