Advertisement
JohnJuly

Untitled

Nov 30th, 2023
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.71 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace Homework21_1
  8. {
  9.     internal class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             int[] bag = new int[1] { 45 };
  14.             int[] tempBag = new int[bag.Length + 1];
  15.  
  16.             for(int i = 0; i < bag.Length; i++)
  17.             {
  18.                 tempBag[i] = bag[i];
  19.                 Console.WriteLine(bag[i]);
  20.             }
  21.             tempBag[tempBag.Length - 1] = 78;
  22.  
  23.             bag = tempBag;
  24.  
  25.             for (int i = 0; i < bag.Length; i++)
  26.             {
  27.                 Console.WriteLine(bag[i]);
  28.             }
  29.         }
  30.     }
  31. }
  32.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement