Advertisement
Guest User

Untitled

a guest
Nov 22nd, 2019
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.18 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 Es_gb
  8. {
  9.     class Program
  10.     {
  11.         //riempimento manuale di due vettori
  12.         private static int[] vet1 = new int[] { 5, 2, 4, 6, 9, 9 };
  13.         private static int[] vet2 = new int[] { 5, 3, 5, 0, 5, 9 };
  14.         static void Main(string[] args)
  15.         {
  16.             int count = 1;
  17.             int c2 = 1;
  18.  
  19.             for (int i = 0; i < vet1.Length; i++)
  20.             {
  21.                 for (int j = 0; j < vet2.Length; j++)
  22.                 {
  23.                     if (vet1[i] != vet2[j])
  24.                     {
  25.                         count++;
  26.                     }
  27.                     if (vet2[i] != vet1[j])
  28.                     {
  29.                         c2++;
  30.                     }
  31.                 }
  32.                 if (count > vet1.Length)
  33.                 {
  34.                     Console.WriteLine(vet1[i]);
  35.                 }
  36.                 if (c2 > vet1.Length)
  37.                     Console.WriteLine(vet2[i]);
  38.                 count = 1;
  39.                 c2 = 1;
  40.             }
  41.             Console.ReadKey();
  42.         }
  43.     }
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement