Advertisement
Guest User

Untitled

a guest
Feb 8th, 2016
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.77 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5.  
  6. namespace ConsoleApplication1
  7. {
  8. class Program
  9. {
  10. static void Main(string[] args)
  11. {
  12. /*
  13. * Задача И4-17. /ЕДНАКВИ И ПОДОБНИ ТРИЪГЪЛНИЦИ/ В масива A(N,3) са зададени дължините на страните
  14. * на триъгълници. Отпечатайте номерата на еднаквите и подобните триъгълници.
  15. */
  16. Console.Write("Vuvedete broy na triugulnicite: ");
  17. int n = int.Parse(Console.ReadLine());
  18. double[,] a = new double[n, 3];
  19. for (int i = 0; i < n; i++)
  20. {
  21. Console.WriteLine();
  22. Console.WriteLine("Vuvedete stranite na triugulnik nomer {0}: ", i + 1);
  23. for (int j = 0; j < 3; j++)
  24. {
  25. Console.Write("Vuvedete STRANA #{0}: ", j + 1);
  26. a[i, j] = double.Parse(Console.ReadLine());
  27. }
  28. }
  29.  
  30. Console.WriteLine();
  31. bool b = false;
  32. for (int i = 0; i < n; i++)
  33. for (int j = 0; j < n; j++)
  34. {
  35. if (a[i, 0] == a[j, 0] && a[i, 1] == a[j, 1] && a[i, 2] == a[j, 2] && i != j) { b = true; Console.WriteLine("Tr {0} e ednakuv na tr {1}", i + 1, j + 1); }
  36. else if (a[i, 0] / a[j, 0] == a[i, 1] / a[j, 1] && a[i, 1] / a[j, 1] == a[i, 2] / a[j, 2] && i != j) { b = true; Console.WriteLine("Tr {0} e podoben na tr {1}", i + 1, j + 1); }
  37. }
  38. if (!b) Console.WriteLine("Nqma ednakvi ili podobni triugulnici");
  39. }
  40. }
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement