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.
uses crt;
var a,b,c,p,s,am,bn,cp:real;
begin
clrscr;
write('Nhap a='); readln(a);
write('Nhap b='); readln(b);
write('Nhap c='); readln(c);
if (a>0) and (b>0) and (c>0) and (a+b>c) and (a+c>b) and (b+c>a) then
begin
writeln('Day la ba canh trong mot tam giac vuong');
p:=(a+b+c)/2;
s:=sqrt(p*(p-a)*(p-b)*(p-c));
writeln('Dien tich tam giac la: ',s:4:2);
am:=sqrt(2*(sqr(b)+sqr(c))-sqr(a))/4;
bn:=sqrt(2*(sqr(a)+sqr(c))-sqr(b))/4;
cp:=sqrt(2*(sqr(a)+sqr(b))-sqr(c))/4;
writeln('Do dai duong trung tuyen ung voi canh a la: ',am:4:2);
writeln('Do dai duong trung tuyen ung voi canh b la: ',bn:4:2);
writeln('Do dai duong trung tuyen ung voi canh c la: ',cp:4:2);
end
else writeln('Day khong la ba canh trong mot tam giac');
readln;
end.
Program HOC24;
var t: longint;
a,b: integer;
function gt(x: integer): longint;
var i: integer; tich: longint;
begin
tich:=1;
for i:=1 to n tich:=tich*i;
gt:=tich;
end;
begin
write('Nhap a: '); readln(a);
write('Nhap b: '); readln(b);
t:=gt(a)+gt(b)+gt(a-b);
write('T = ',t);
readln
end.
#include <bits/stdc++.h>
using namespace std;
long long n;
int main()
{
cin>>n;
bool kt=true;
for (int i=2; i*i<=n; i++)
if (n%i==0) kt=false;
if (kt==true && n>=2) cout<<"YES";
else cout<<"NO";
return 0;
}
Câu 1:
uses crt;
var a,b,c,p,s:real;
begin
clrscr;
repeat
write('Nhap a='); readln(a);
write('Nhap b='); readln(b);
write('Nhap c='); readln(c);
until (a>0) and (b>0) and (c>0);
if (a+b>c) and (a+c>b) and (b+c>a) then
begin
p:=(a+b+c)/2;
s:=sqrt(p*(p-a)*(p-b)*(p-c));
writeln('Dien tich tam giac la: ',s:4:2);
end
else writeln('Day khong la ba canh trong mot tam giac');
readln;
end.
Câu 2:
uses crt;
var a:array[1..100]of integer;
i,n,t,max,min:integer;
begin
clrscr;
write('Nhap n='); readln(n);
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
t:=0;
for i:=1 to n do
t:=t+a[i];
writeln('Tong cac phan tu trong day la: ',t);
max:=a[1];
min:=a[1];
for i:=1 to n do
begin
if max<a[i] then max:=a[i];
if min>a[i] then min:=a[i];
end;
writeln('Gia tri lon nhat la: ',max);
writeln('Gia tri nho nhat la: ',min);
readln;
end.
nếu câu b bài 2 được tách riêng thành 1 câu riêng biệt...thì thay thế bắt đầu từ đâu ạ
uses crt;
var a,b,c,tb:array[1..100]of real;
i,n:integer;
begin
clrscr;
n:=5;
for i:=1 to n do
begin
readln(a[i],b[i],c[i]);
end;
for i:=1 to n do
tb[i]:=(a[i]+b[i]+c[i])/3;
for i:=1 to n do
writeln('Diem trung binh cua ban thu ',i,' la: ',tb[i]:4:2);
readln;
end.
program nhap_tinhtong;
uses crt;
type kmang=array[1..1000] of integer;
var A:kmang;
n:integer;
{---Nhap---}
procedure nhap;
var i:integer;
begin
write('Nhap n: '); readln(n);
for i:=1 to n do
begin
write('A[',i,']= '); readln(A[i]);
end;
end;
{---Tinh-tong---}
function tinh_tong(A:kmang; n:integer):integer;
var t,i:integer;
begin
t:=0;
for i:=1 to n do
t:=t+A[i];
tinh_tong:=t;
end;
{---CT-chinh---}
BEGIN
clrscr;
nhap;
write('Tong cac phan tu la: ',tinh_tong(A,n));
readln;
end.
program nhap_tinhtong;
uses crt;
type kmang=array[1..1000] of integer;
var A:kmang;
n:integer;
{---Nhap---}
procedure nhap;
var i:integer;
begin
write('Nhap n: '); readln(n);
for i:=1 to n do
begin
write('A[',i,']= '); readln(A[i]);
end;
end;
{---Tinh-tong---}
function tinh_tong(A:kmang; n:integer):integer;
var t,i:integer;
begin
t:=0;
for i:=1 to n do
t:=t+A[i];
tinh_tong:=t;
end;
{---CT-chinh---}
BEGIN
clrscr;
nhap;
write('Tong cac phan tu la: ',tinh_tong(A,n));
readln;
end.
#include <bits/stdc++.h>
using namespace std;
long long n,i,x,t;
int main()
{
cin>>n;
t=0;
for (i=1; i<=n; i++)
{
cin>>x;
if (x<0) t+=x;
}
cout<<t;
return 0;
}
#include <bits/stdc++.h>
using namespace std;
long long a[1000],i,n,t;
int main()
{
cin>>n;
for (i=1; i<=n; i++) cin>>a[i];
t=0;
for (i=1; i<=n; i++) t+=a[i];
cout<<t<<endl;
sort(a+1,a+n+1);
for (i=1; i<=n; i++) cout<<a[i]<<" ";
return 0;
}
<bits/stdc++.h>
using namespace std;
int DTT(int a, int b, int c)
int m = sqrt(2*b*b+2*c*c-a*a)/2;
return m;
int main()
int a, b, c, m;
cout << "Nhap ba canh tam giac" << endl;
cin >> a >> b >> c;
m = DTT(a,b,c);
cout << m;
return 0;
end.
uses crt;
var a,b,c:real;
{-----------------chuong-trinh-con--------------------}
function ttuyen(x,y,z:real):integer;
begin
ttuyen:=(2*(sqr(ab)+sqr(ac))-sqr(bc));
end;
{---------------chuong-trinh-chinh-----------------------}
begin
clrscr;
repeat
write('a='); readln(a);
write('b='); readln(b);
write('c='); readln(c);
until (a>0) and (b>0) and (c>0) and (a+b>c) and (a+c>b) and (b+c>a);
writeln(sqrt(ttuyen(a,b,c))/4:4:2);
readln;
end.