Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace Array_1d
- {
- internal class Program
- {
- static void Main(string[] args)
- {
- Console.Write("How many elements do you want to have: ");
- int size = int.Parse(Console.ReadLine());
- int[] a = new int[size];
- int[] b = new int[size];
- int[] c = new int[size];
- Console.WriteLine("Array a:");
- for (int i = 0; i < a.Length; i++)
- {
- Console.Write($"a[{i}]: ");
- a[i] = int.Parse(Console.ReadLine());
- }
- Console.WriteLine("Array b:");
- for (int i = 0; i < a.Length; i++)
- {
- Console.Write($"b[{i}]: ");
- b[i] = int.Parse(Console.ReadLine());
- }
- Console.Clear();
- for (int i = 0; i < a.Length; i++)
- {
- Console.Write($"{a[i]}, ");
- }
- Console.WriteLine();
- for (int i = 0; i < a.Length; i++)
- {
- Console.Write($"{b[i]}, ");
- }
- Console.WriteLine( );
- Console.WriteLine("Array c = a + b:");
- for (int i = 0; i < a.Length; i++)
- {
- c[i] = a[i] + b[i];
- Console.Write($"{c[i]}, ");
- }
- Console.ReadKey();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement