vakho

C# დავალება 4;

Oct 23rd, 2012
578
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.89 KB | None | 0 0
  1. /*
  2.  * 4.
  3.  * კონსოლიდან შეიტანეთ მართკუთხედის სამი წვეროს X და Y კოორდინატები.
  4.  * მართკუთხედის გვერდები საკოორდინატო გვერდების პარალელურია.
  5.  * იპოვეთ მეოთხე წვეროს კოორდინატები და გამოიტანეთ კონსოლში.
  6.  */
  7.  
  8. using System;
  9. using System.Collections.Generic;
  10. using System.Linq;
  11. using System.Text;
  12.  
  13. namespace ConsoleApplication11
  14. {
  15.     class Program
  16.     {
  17.         static void Main(string[] args)
  18.         {
  19.             int[] X = new int[4];
  20.             int[] Y = new int[4];
  21.  
  22.             for (int i = 0; i < 3; i++)
  23.             {
  24.                 X[i] = Convert.ToInt32(Console.ReadLine());
  25.                 Y[i] = Convert.ToInt32(Console.ReadLine());
  26.             }
  27.  
  28.             if (X[0] == X[1])
  29.             {
  30.                 X[3] = X[2];
  31.                 Console.WriteLine(X[3].ToString());
  32.             }
  33.             else if (X[0] == X[2])
  34.             {
  35.                 X[3] = X[1];
  36.                 Console.WriteLine(X[3].ToString());
  37.             }
  38.             else if (X[1] == X[2])
  39.             {
  40.                 X[3] = X[0];
  41.                 Console.WriteLine(X[3].ToString());
  42.             }
  43.  
  44.             if (Y[0] == Y[1])
  45.             {
  46.                 Y[3] = Y[2];
  47.                 Console.WriteLine(Y[3].ToString());
  48.             }
  49.             else if (Y[0] == Y[2])
  50.             {
  51.                 Y[3] = Y[1];
  52.                 Console.WriteLine(Y[3].ToString());
  53.             }
  54.             else if (Y[1] == Y[2])
  55.             {
  56.                 Y[3] = Y[0];
  57.                 Console.WriteLine(Y[3].ToString());
  58.             }
  59.  
  60.             Console.ReadKey();
  61.         }
  62.     }
  63. }
Advertisement
Add Comment
Please, Sign In to add comment