1-misol.
begin 19. to'g'ri to'rtburchakning qarama-qarshi uchlari koordinatalari berilgan. Uning tomonlari koordinata o'qiga parallel. To'g'ri to'rtburchak perimetri va yuzasi aniqlansin.
1-usul
using System;
class HelloWorld {
static void TugriTurtburchak(){
double x1,x2,y1,y2;
Console.Write("Tug'ri turtburchakning qarama-qarshi uchlari koordinatasini kiriting:x1=");
x1=Convert.ToDouble(Console.ReadLine());
Console.Write("x2=");
x2=Convert.ToDouble(Console.ReadLine());
Console.Write("y1=");
y1=Convert.ToDouble(Console.ReadLine());
Console.Write("y2=");
y2=Convert.ToDouble(Console.ReadLine());
Console.WriteLine("Turtburchak perimetiri " +(2*(Math.Abs(x2-x1)+Math.Abs(y2-y1)))+" ga teng.");
Console.WriteLine("Turtburchak yuzi "+(Math.Abs(x2-x1)*Math.Abs(y2-y1))+" ga teng.");
}
public static void Main()
{
TugriTurtburchak();
Console.ReadKey(true);
}
}
Do'stlaringiz bilan baham: |