Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- namespace ConsoleApplication1
- {
- class Program
- {
- static void Main(string[] args)
- {
- /*
- * Задача И4-17. /ЕДНАКВИ И ПОДОБНИ ТРИЪГЪЛНИЦИ/ В масива A(N,3) са зададени дължините на страните
- * на триъгълници. Отпечатайте номерата на еднаквите и подобните триъгълници.
- */
- Console.Write("Vuvedete broy na triugulnicite: ");
- int n = int.Parse(Console.ReadLine());
- double[,] a = new double[n, 3];
- for (int i = 0; i < n; i++)
- {
- Console.WriteLine();
- Console.WriteLine("Vuvedete stranite na triugulnik nomer {0}: ", i + 1);
- for (int j = 0; j < 3; j++)
- {
- Console.Write("Vuvedete STRANA #{0}: ", j + 1);
- a[i, j] = double.Parse(Console.ReadLine());
- }
- }
- Console.WriteLine();
- bool b = false;
- for (int i = 0; i < n; i++)
- for (int j = 0; j < n; j++)
- {
- 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); }
- 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); }
- }
- if (!b) Console.WriteLine("Nqma ednakvi ili podobni triugulnici");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement