Advertisement
Guest User

Untitled

a guest
Nov 2nd, 2019
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.56 KB | None | 0 0
  1. static void Main(string[] args)
  2.         {
  3.             int[] arr = { 1, 2, 3, -4, 5, 6, 7, 8, 9, 10 };
  4.             Change(arr);
  5.  
  6.  
  7.             Console.ReadKey();
  8.  
  9.         }
  10.         public static void Change(int[] array)
  11.         {
  12.             int sign = array[0];
  13.             int a = -1;
  14.             for (int i = 0; i < array.Length; i++)
  15.             {
  16.                 if (array[i] > 0)
  17.                 {
  18.                     Console.WriteLine(a * array[i]);
  19.                 }
  20.                 else
  21.                 {
  22.                     Console.WriteLine(a
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement