Last active
August 10, 2018 16:46
-
-
Save wannaphong/a153fc38df080884f8d0d5e024d907ac to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System; | |
| public class MyProgram | |
| { | |
| public static void Main(String[] args) | |
| { | |
| int n; | |
| int[] A = new int[4]; | |
| int[] B = new int[4]; | |
| int[] C = new int[4]; | |
| n = 1; | |
| A[0] = 1; | |
| A[1] = 4; | |
| A[2] = 5; | |
| A[3] = 7; | |
| B[0] = 2; | |
| B[1] = 4; | |
| B[2] = 6; | |
| B[3] = 7; | |
| C[0] = 3; | |
| C[1] = 5; | |
| C[2] = 6; | |
| C[3] = 7; | |
| int i; | |
| for (i = 0 ; i <= 3 ; i += 1) | |
| { | |
| if (n == A[i]) | |
| { | |
| int j; | |
| Boolean inb; | |
| inb = false; | |
| j = 0; | |
| while (j < 4 && inb != true) | |
| { | |
| if (n == B[j]) | |
| { | |
| inb = true; | |
| } | |
| j = j + 1; | |
| } | |
| if (inb == false) | |
| { | |
| inb = false; | |
| j = 0; | |
| while (j < 4 && inb != true) | |
| { | |
| if (n == C[j]) | |
| { | |
| inb = true; | |
| } | |
| j = j + 1; | |
| } | |
| if (inb == true) | |
| { | |
| Console.WriteLine("n อยู่ใน A,C แต่ไม่อยู่ใน B"); | |
| } | |
| else | |
| { | |
| Console.WriteLine("n อยู่ใน A แต่ไม่อยู่ใน Bและ C"); | |
| } | |
| } | |
| else | |
| { | |
| Console.WriteLine("n อยู่ใน A และอยู่ใน B"); | |
| } | |
| } | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment