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.
#include <bits/stdc++.h>
using namespace std;
double a,b,cv,dt;
int main()
{
cin>>a>>b;
cv=(a+b)*2;
dt=a*b;
cout<<fixed<<setprecision(2)<<cv<<endl;
cout<<fixed<<setprecision(2)<<dt;
return 0;
}
Program HOC24;
const fi='Data.txt';
fo='Result.txt';
var f: text;
a,b: integer;
dt,cv: longint;
dc: real;
procedure ip;
begin
assign(f,fi);
reset(f);
readln(f,a);
readln(f,b);
close(f);
end;
procedure out;
begin
assign(f,fo);
rewrite(f);
dt:=a*b;
cv:=(a+b)*2;
dc:=sqrt((a*a)+(b*b));
writeln(f,'Chu vi hinh chu nhat la : ',cv);
writeln(f,'Dien tich cua hinh chu nhat la : ',dt);
write(f,'Chieu dai cua duong cheo la : ',dc:1:2);
close(f);
end;
begin
ip;
out;
end.
uses crt;
var a:array[1..250]of integer;
i,n,t:integer;
begin
clrscr;
readln(n);
t:=0;
for i:=1 to n do readln(a[i]);
for i:=1 to n do write(a[i]:4);
writeln;
for i:=1 to n do t:=t+a[i];
writeln(t);
readln;
end.
uses crt;
var a,b:array[1..100]of integer;
n,i,dem,max,tam,j:integer;
begin
clrscr;
repeat
write('Nhap n='); readln(n);
until (0<n) and (n<=100);
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
writeln('Cac so chia het cho 4 la: ');
for i:=1 to n do
if a[i] mod 4=0 then write(a[i]:4);
writeln;
dem:=0;
for i:=1 to n do
if a[i] mod 7=0 then
begin
inc(dem);
b[dem]:=a[i];
end;
max:=b[1];
for i:=1 to dem do
if max<b[i] then max:=b[i];
writeln('So lon nhat chia het cho 7 la: ',max);
writeln('Cac chi so cua no trong day A la: ');
for i:=1 to n do
if max=a[i] then write(i:4);
writeln;
for i:=1 to n-1 do
for j:=i+1 to n do
if a[i]<a[j] then
begin
tam:=a[i];
a[i]:=a[j];
a[j]:=tam;
end;
writeln('Day so sau khi sap xep giam dan la: ');
for i:=1 to n do
write(a[i]:4);
readln;
end.
uses crt;
var a:array[1..100]of integer;
i,n,t:integer;
begin
clrscr;
write('n='); readln(n);
if (n>0) and (n<=100) then
begin
t:=0;
for i:=1 to n do
begin
write('a[',i,']='); readln(a[i]);
if (a[i] mod 2=0) or (a[i] mod 2=1) then t:=t+a[i];
end;
writeln('tong cac phan tu chan hoac le trong day la: ',t);
end
else writeln('vui long nhap lai');
readln;
end.
uses crt;
var n,i,t:integer;
begin
clrscr;
readln(n);
t:=0;
for i:=1 to n do
if i mod 2=1 then t:=t+i;
writeln(t);
readln;
end.
uses crt;
var a:array[1..100]of integer;
i,n,dem:integer;
begin
clrscr;
write('Nhap n='); readln(n);
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
dem:=0;
for i:=1 to n do
if a[i] mod 3=0 then
begin
inc(dem);
write(a[i]:4);
end;
writeln;
writeln('So phan tu chia het cho 3 la: ',dem);
readln;
end.
#include <bits/stdc++.h>
using namespace std;
int main()
{
float a,b,s,d;
cin>>a>>b;
d=sqrt(a*a+b*b);
s=a*b;
cout<<"Do dai duong cheo la:"<<fixed<<setprecision(2)<<d<<endl;
cout<<"Dien tich la:"<<fixed<<setprecision(2)<<s;
return 0;
}
#include <iostream>
using namespace std;
int main()
{
int n;
double S;
cin >> n;
for(int i=1; i<=n; i++)
S+=1.0/i;
cout << double(S) << endl;
return 0;
}
Chúc bn học tốt!