Microsoft Small Basic

Program Listing:
Embed this in your website
n=20
For i=1 To n
  x=Math.GetRandomNumber(100)
  If Array.ContainsValue(sir1,x)="False" Then
    sir1[i]=x
  EndIf
  x=Math.GetRandomNumber(100)
  If Array.ContainsValue(sir2,x)="False" Then
    sir2[i]=x
  EndIf
EndFor

k=1
For i=1 To n
  For j=1 To n
    If sir1[i]=sir2[j] Then
      sir3[k]=sir1[i]
      k=k+1
    EndIf
  EndFor
EndFor

k=1
For i=1 To n
  If Array.ContainsValue(sir4,sir1[i])="False" Then
    sir4[k]=sir1[i]
    k=k+1
  EndIf
  If Array.ContainsValue(sir4,sir2[i])="False" Then
    sir4[k]=sir2[i]
    k=k+1
  EndIf
EndFor

TextWindow.WriteLine("Primul sir:")
For i=1 To n
  TextWindow.Write(sir1[i]+" ")
EndFor

TextWindow.WriteLine("")
TextWindow.WriteLine("Al doilea sir:")
For i=1 To n
  TextWindow.Write(sir2[i]+" ")
EndFor

TextWindow.WriteLine("")
TextWindow.WriteLine("Intersectia sirurilor:")
For i=1 To Array.GetItemCount(sir3)
  TextWindow.Write(sir3[i]+" ")
EndFor

TextWindow.WriteLine("")
TextWindow.WriteLine("Reuniunea sirurilor:")
For i=1 To Array.GetItemCount(sir4)
  TextWindow.Write(sir4[i]+" ")
EndFor
Copyright (c) Microsoft Corporation. All rights reserved.