Sonlar o’qida x1 va x2 nuqta koordinatalari berilgan. Bu nuqtalar orasidagi masofani topish dasturini tuzilsin
Sana 30.03.2022 Hajmi 39,74 Kb. #519049
Bog'liq
1a.-topshiriq.Olimov Muslimbek
N9 . Sonlar o’qida x1 va x2 nuqta koordinatalari berilgan.Bu nuqtalar orasidagi masofani topish dasturini tuzilsin.
Dasturning blok sxemadagi algoritmi:
X1 va x2 ning koordinatasini kiriting
Boshlansin
D=|x1-x2|
Natija
Tamom
Masalaning C# dasturlash tilidagi matni:
using System;
namespace Olimov_Muslimbek_Amaliy_mashg_ulot1
{
class Program
{
public static void Main (string[] args)
{
Console.Write ("x1 nuqta koordinatasini kiriting: x1=");
double x1=double .Parse (Console.ReadLine ());
Console.Write ("x2 nuqta koordinatasini kiriting: x2=");
double x2=double .Parse (Console.ReadLine ());
double D=Math.Abs (x1-x2);
Console.WriteLine ("Natija:"+D);
Console.ReadKey (true );
}
}
} Do'stlaringiz bilan baham: