Viết chương trình nhập từ bàn phím ba số thực a,b,c và tìm nghiệm của phương trình bậc 2
Hãy nhập câu hỏi của bạn vào đây, nếu là tài khoản VIP, bạn sẽ được ưu tiên trả lời.


Câu 1:
uses crt;
var a,b:integer;
begin
clrscr;
readln(a,b);
write(a+b);
readln;
end.
Câu 2:
uses crt;
var a,b,c:integer;
begin
clrscr;
readln(a,b,c);
writeln(a+b-c);
readln;
end.
Câu 3:
uses crt;
var a,b:integer;
begin
clrscr;
readln(a,b);
writeln(a-b);
readln;
end.
Câu 4:
uses crt;
var x,y,z:integer;
begin
clrscr;
readln(x,y,z);
writeln((x+y)*z);
readln;
end.

#include <bits/stdc++.h>
using namespace std;
double b,c;
int main()
{
cin>>b>>c;
if ((b==0) and (c==0)) cout<<"Vo so nghiem";
else if ((b==0) and (c!=0)) cout<<"Vo nghiem";
else cout<<fixed<<setprecision(2)<<-c/b;
return 0;
}

#include <bits/stdc++.h>
using namespace std;
double b,c;
int main()
{
cin>>b>>c;
if ((b==0) and (c==0)) cout<<"Vo so nghiem";
else if ((b==0) and (c!=0)) cout<<"Vo nghiem";
else cout<<fixed<<setprecision(2)<<-c/b;
return 0;
}

#include <bits/stdc++.h>
using namespace std;
double b,c;
int main()
{
cin>>b>>c;
if ((b==0) and (c==0)) cout<<"Vo so nghiem";
else if ((b==0) and (c!=0)) cout<<"Vo nghiem";
else cout<<fixed<<setprecision(2)<<-c/b;
return 0;
}

Test 1:
a=2; b=4
=>-2
Test 2:
a=0; b=0;
=>Vô số nghiệm

import math
a = float(input("Nhập a: "))
b = float(input("Nhập b: "))
c = float(input("Nhập c: "))
d = b**2 - 4*a*c
if d > 0:
x1 = (-b + math.sqrt(d)) / (2*a)
x2 = (-b - math.sqrt(d)) / (2*a)
print("Phương trình có hai nghiệm: x1 =", x1, "và x2 =", x2)
elif d == 0:
x = -b / (2*a)
print("Phương trình có nghiệm kép: x =", x)
else:
print("Phương trình không có nghiệm thực."

program tim_chu_so;
uses crt;
var i,n,csln:longint;
k:integer;
a:array[1..1000]of longint;
st:string;
begin
clrscr;
write('nhap so n:');readln(n);
str(n,st);
val(st,a[i]);
csln:=a[1];
for i:=1 to length(st) do
if csln<a[i] then csln:=a[i];
writeln('chu so lon nhat cua so ',n,' la:',csln);
readln;
end.
Câu 1:
uses crt;
var n,i,d,x,y,max:integer;
st:string;
begin
clrscr;
write('Nhap n='); readln(n);
str(n,st);
d:=length(st);
max:=0;
for i:=1 to d do
begin
val(st[i],x,y);
if max<x then max:=x;
end;
writeln('Chu so lon nhat la: ',max);
readln;
end.

Câu 1:
#include <bits/stdc++.h>
using namespace std;
double a,b,c;
int main()
{
cin>>a>>b>>c;
cout<<fixed<<setprecision(2)<<a*b*c;
return 0;
}
Dưới đây là hướng dẫn thực hiện nhiệm vụ 2 bài tập thực hành 31 trang 151 sách giáo khoa KNTT Tin học 10:
Lưu ý:
Nếu cần hỗ trợ cụ thể, bạn có thể đọc kỹ hướng dẫn trong sách giáo khoa.
Nhơ tặng coin hoặc tick cho mình nhé!
Dưới đây là giải thích cách viết chương trình giải phương trình bậc 2 trong vi:
Các bước chính:
Chú ý: