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.
Bài 4
uses crt;
var a,b: integer;
c,s,d:real;
begin
clrscr;
readln(a,b);
if (a>0) and (b>0) then
begin
c:=sqrt(a*a+b*b);
d:=(a+b+c)/2;
s:=sqrt(d*(d-a)*(d-b)*(d-c));
writeln(c:4:2,' ',s:4:2);
end
else writeln('nhap lai');
readln
end.
Bài 5
uses crt;
var r: integer;
s,t: real;
begin
clrscr;
readln(r);
s:=r*r*3.14;
t:=2*3.14*r;
writeln(s:4:2,' ',t:4:2);
readln
end.
#include <bits/stdc++.h>
using namespace std;
long long a,b,c,d,t;
int main()
{
cin>>a>>b>>c>>d;
t=a+b+c+d;
cout<<t;
return 0;
}
Câu 1:
Dùng for..do
uses crt;
var a,i:integer;
begin
clrscr;
a:=0;
for i:=1 to 100 do
if i mod 2=0 then a:=a+i;
writeln(a);
readln;
end.
Dùng While...do
uses crt;
var a,i:integer;
begin
clrscr;
a:=0;
i:=1;
while i<=100 do
begin
if i mod 2=0 then a:=a+i;
inc(i);
end;
writeln(a);
readln;
end.
begin
writeln('*****');
writeln('*****');
writeln('*****');
writeln('*****');
writeln('*****');
readin
end.
#include <bits/stdc++.h>
using namespace std;
long long n,i,x,dem;
int main()
{
cin>>n;
dem=0;
for (i=1; i<=n; i++)
{
cin>>x;
if (x%2==0) dem++;
}
cout<<dem;
return 0;
}
#include <bits/stdc++.h>
using namespace std;
long long a[10],n=10,i,ln;
int main()
{
for (i=1; i<=n; i++) cin>>a[i];
ln=a[1];
for (i=1; i<=n; i++) ln=max(ln,a[i]);
cout<<ln<<endl;
if (ln%2==0) cout<<"Phai";
else cout<<"Khong phai";
return 0;
}
program bt;
uses crt;
var i, max : integer;
a : array[1..10] of integer;
begin
clrscr;
for i:=1 to 10 do begin
write('Nhap so thu ',i,': '); readln(a[i]);
end;
max := 0;
for i:=1 to 10 do if a[i] > max then max := a[i];
if (max mod 2 = 0) then write(max,' la so lon nhat va la so chan')
else write(max,' la so lon nhat va la so le');
readln
end.
#include <bits/stdc++.h>
using namespace std;
double a,cv,dt;
int main()
{
cin>>a;
cv=a*4;
dt=a*a;
cout<<fixed<<setprecision(2)<<cv<<endl;
cout<<fixed<<setprecision(2)<<dt;
return 0;
}