Generation

generate functionMon, 08 May 2023

dado 2 vectores con números enteros crear un tercer vector con la suma de los valores anteriores

using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { int[] a = { 1, 2, 3, 4, 5, 6}; int[] b = { 7, 8, 9, 10, 11, 12}; int[] c = new int[a.Length]; for (int i = 0; i < a.Length; i++) { c[i] = a[i] + b[i]; } foreach (var item in c) { Console.WriteLine(item); } Console.ReadKey(); } } }

Questions about programming?Chat with your personal AI assistant