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.
THAM KHẢO:
uses crt;
var a,cv,dt:integer;
begin
clrscr;
write('a='); readln(a);
cv:=a*4;
dt:=sqr(a);
if a>0 then
begin
writeln('chu vi hinh vuong la: ',cv);
writeln('dien tich hinh vuong la: ',dt);
end
else writeln('vui long nhap so a lon hon 0');
readln;
end.
Program Hinh_tron;
Uses crt;
Var r,dt:real;
Begin
clrscr;
Writeln(' Nhap ban kinh hinh tron:');
Readln(r);
dt:= r*r*3.14;
Writeln('Dien tich hinh tron la:',dt);
Readln;
End.
Câu 1:
uses crt;
var n,i,kt:integer;
begin
clrscr;
write('Nhap n='); readln(n);
if n<2 then writeln(n,' khong la so nguyen to')
else begin
kt:=0;
for i:=2 to n-1 do
if n mod i=0 then kt:=1;
if kt=0 then writeln(n,' la so nguyen to')
else writeln(n,' khong la so nguyen to');
end;
readln;
end.
Câu 2:
uses crt;
var a:array[1..100]of integer;
i,n,max,min:integer;
begin
clrscr;
write('Nhap n='); readln(n);
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
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('So lon nhat la: ',max);
writeln('So nho nhat la: ',min);
readln;
end.
#include <bits/stdc++.h>
using namespace std;
long long a,b;
int main()
{
cin>>a>>b;
cout<<a-b;
return 0;
}
a)Hình vuông
Program bt;
Var a,S,Cv:integer;
Begin
Writeln('Nhap a:=');
Readln(a);
S:=a*a;
Writeln('Dien tich hinh vuong la:=',S);
Cv:=a*4;
Writeln('Chu vi hinh vuong la:=',Cv);
Readln;
End.
mình dồn 5 cái này vào cùng 1 bài luôn
program thinh;
uses crt;
var a,dt,dai,rong,dt_hcn,r,c1,c2,c3,hthang,c,d,b,cv,cv_hcn,b1,b2,cv_ht:integer;
hinh:string;
s_tron,p,s,s_ht,cv_tron,cv_tg:real;
begin
clrscr;
write('nhap hinh ban muon tinh chu vi va dien tich:'); readln(hinh);
case hinh of
'hinh vuong':
begin
repeat
write('nhap canh cua hinh vuong:'); readln(a);
if a<=0 then writeln('ban da nhap sai, yeu cau ban nhap lai');
until a>0;
cv:=a*4;
dt:=a*a;
writeln('chu vi cua hinh vuong co canh ',a,'cm la: ',cv);
writeln('dien tich hinh vuong co canh la: ',a,'cm la: ',dt);
end;
'hinh chu nhat':
begin
repeat
write('nhap chieu dai:'); readln(dai);
write('nhap chieu rong:'); readln(rong);
if (dai<=rong) or (dai<=0) or (rong<=0) then
writeln('ban da nhap sai, yeu cau ban nhap lai');
until (dai>rong) and (dai>0) and (rong>0);
cv_hcn:=(dai+rong)*2;
dt_hcn:=dai*rong;
writeln('chu vi hinh chu nhat co chieu dai la ',dai,'cm va chieu rong la ' ,rong,'cm la: ',cv_hcn);
writeln('dien tich hinh chu nhat co chieu dai la ',dai,'cm va chieu rong la ' ,rong,'cm la: ',dt_hcn);
end;
'hinh tron':
begin
repeat
write('nhap ban kinh:'); readln(r);
if r<=0 then writeln('ban da nhap sai, yeu cau ban nhap lai');
until r>0;
cv_tron:=2*r*pi;
s_tron:=sqr(r)*pi;
writeln('chu vi hinh tron co ban kinh la ',r,'cm la: ',cv_tron:4:2);
writeln('dien tich hinh tron co ban kinh la ',r,'cm la: ',s_tron:4:2);
end;
'hinh tam giac':
begin
repeat
write('nhap canh thu 1:'); readln(c1);
write('nhap canh thu 2:'); readln(c2);
write('nhap canh thu 3:'); readln(c3);
if (c1+c2<=c3) or (c1+c3<=c2) or (c2+c3<=c1) then
writeln('ban da nhap sai, yeu cau ban nhap lai');
until (c1+c2>c3) and (c1+c3>c2) and (c2+c3>c1);
p:=(c1+c2+c3)/2;
cv_tg:=p*2;
s:=sqrt(p*(p-c1)*(p-c2)*(p-c3));
writeln('chu vi hinh tam giac co 3 canh lan luot la: ',c1,'cm;',c2,'cm;',c3,'cm la: ',cv_tg:4:2);
writeln('dien tich hinh tam giac co 3 canh lan luot la: ',c1,'cm;',c2,'cm;',c3,'cm la: ',s:4:2);
end;
'hinh thang':
begin
write('nhap chieu cao hinh thang:'); readln(hthang);
write('nhap canh day thu 1:'); readln(c);
write('nhap canh day thu 2:'); readln(d);
write('nhap canh ben thu 1: '); readln(b1);
write('nhap canh ben thu 2: '); readln(b2);
s_ht:=1/2*hthang*(c+d);
cv_ht:=c+d+b1+b2;
writeln('dien tich hinh thang co do dai hai canh day la: ',c,'cm va ',d,'cm la: ',s_ht:4:2);
writeln('chu vi hinh thang co do dai hai canh ben la: ',b1,'cm va ',b2,'cm; do dai hai canh day la: ',c,'cm va ',d,'cm la: ',cv_ht);
end;
end;
readln;
end.
uses crt;
var a:array[1..100]of integer;
n,i:integer;
begin
clrscr;
repeat
write('Nhap n='); readln(n);
if n<=0 then writeln('Ban nhap sai, yeu cau nhap lai');
until n>0;
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
for i:=1 to n do
if a[i] mod 2=0 then write(a[i]:4);
readln;
end.
uses crt;
var a:array[1..100]of integer;
n,i,max,min,t:integer;
begin
clrscr;
write('Nhap n='); readln(n);
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
max:=a[1];
for i:=1 to n do
if max<a[i] then max:=a[i];
min:=a[1];
for i:=1 to n do
if min>a[i] then min:=a[i];
t:=0;
for i:=1 to n do
t:=t+a[i];
writeln('Gia tri lon nhat la: ',max);
writeln('Gia tri nho nhat la: ',min);
writeln('Trung binh cua day so la: ',t/n:4:2);
readln;
end.
#include <bits/stdc++.h>
using namespace std;
long long n,x,t;
int main()
{
cin>>n;
t=0;
while (n>0)
{
x=n%10;
t=t+x;
n/=10;
}
cout<<t;
return 0;
}
Var t,n:integer;
begin
write('nhap n = ');readln(n);
while n div 10 <> 0 do
begin
t:=t+(n mod 10);
n:=n div 10;
end;
write('Tong cac chu so cua ',n,' la ',t);
readln;
end.
#include <bits/stdc++.h>
using namespace std;
double r;
int main()
{
cin>>r;
cout<<fixed<<setprecision(2)<<r*2*pi<<endl;
cout<<fixed<<setprecision(2)<<r*r*pi;
return 0;
}