Yechim:
Quyidagicha Paskal dasturlash tili yordamida irratsional tenglamaning yechimi topish dasturi tuziladi:
2. Program irrasionaltenglama;
var x,a,b,c,D,X1,X2:real;
label 1,2,3;
Begin
Writeln(‘sqrt(x)=x-2 irrasional tenglama yechimlarini toping’);
Write ('c -ga 4 sonini kiriting='); Readln(c);
Write ('a-ga 1 sonini kiriting='); Readln(a);
Write ('b-ga -5 sonini kiriting='); Readln(b);
D:=sqr(b)-4*a*c;
If D>=0 Then goto 2 else goto 1;
1: Writeln('Tenglama yechimga ega emas');goto 3;
2: X1:=(-b+sqr(D))/(2*a);
X2=(-b-sqr(D))/(2*a);
Writeln('X1=',X1);
Writeln('X2=',X2);
Begin
If sqrt(x1)=x1-2 then writeln(x1, ‘-soni irrasional tenglama yechimi’)
else writeln(x1, ‘-soni irrasional tenglamaning chet ildizi’);
end;
Begin
If sqrt(x2)=x2-2 then writeln(x2, ‘-soni irrasional tenglama yechimi’)
else writeln(x2, ‘-soni irrasional tenglamaning chet ildizi’);
end;
3:end.
Izoh:
var x,a,b,c,D,X1,X2:real; - x,a,b,c,D,X1,X2-o’zgaruvchilarni haqiqiy sonlar to’plamiga tegishli ekanligini e’lon qilib olamiz;
label 1,2,3; - 1,2,3 – kerakli joyga o’tish uchun oldindan belgilarni e’lon qilib olamiz;
Begin
dasturning asosiy qismi
end.
Dasturning asosiy qismida masalaning yechimini topish yuzasidan to’liq dastur tuzilgan bo’lib, unda kerakli shartlar bajarilish va shartlar bajarilganda qilinishi kerak bo’lgan ishlar aniq ko’rsatilgan. Paskal dasturini yuklab unga tuzilgan dasturni kiritib, CTRL+F9 tugmalari baravar bosilsa, ekranda quyidagi savol hosil bo’ladi.
sqrt(x)=x-2 irrasional tenglama yechimlarini toping
c -ga 4 sonini kiriting= (4 sonini kiritib Enter tugmasi bosiladi)
Do'stlaringiz bilan baham: |