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.
![](https://rs.olm.vn/images/avt/0.png?1311)
#include <bits/stdc++.h>
using namespace std;
double n,a,d;
int main()
{
cin>>n>>a>>d;
cout<<fixed<<setprecision(2)<<n*(a+d)/2;
return 0;
}
![](https://rs.olm.vn/images/avt/0.png?1311)
#include <bits/stdc++.h>
using namespace std;
long long a,b;
double tb;
int main()
{
freopen("dulieu.inp","r",stdin);
freopen("ketqua.out","w",stdout);
cin>>a>>b;
cout<<a<<" "<<b;
cout<<fixed<<setprecision(2)<<(a*1.0+b*1.0)/(2*1.0);
return 0;
}
![](https://rs.olm.vn/images/avt/0.png?1311)
Câu 1:
var a:array[1..100]of integer;
Câu 2:
uses crt;
var a:array[1..10]of integer;
i:integer;
begin
clrscr;
for i:=1 to 10 do
begin
write('A[',i,']='); readln(a[i]);
end;
for i:=1 to 10 do
write(a[i]:4);
readln;
end.
Câu 3:
uses crt;
var a:array[1..15]of integer;
i,n,t:integer;
begin
clrscr;
repeat
write('Nhap n='); readln(n);
until (0<n) and (n<=15);
for i:=1 to n do
begin
repeat
write('A[',i,']='); readln(a[i]);
until a[i]<=100;
end;
writeln('Mang da nhap la: ');
for i:=1 to n do
write(a[i]:4);
writeln;
t:=0;
for i:=1 to n do
if a[i] mod 3=0 then t:=t+a[i];
writeln('Tong cac phan tu chia het cho 3 la: ',t);
writeln('Cac so chan o vi tri le trong day la: ');
for i:=1 to n do
if (a[i] mod 2=0) and (i mod 2=1) then write(a[i]:4);
readln;
end.
![](https://rs.olm.vn/images/avt/0.png?1311)
#include <bits/stdc++.h>
using namespace std;
long long a[6],i,t,t1;
int main()
{
t=0;
for (i=1; i<=n; i++)
{
cin>>a[i];
if (a[i]%2==0) t=t+a[i];
}
t1=0;
for (i=1; i<=n; i++)
if ((a[i]%2!=0) and (i%2==0)) t1=t1+a[i];
cout<<t<<endl;
cout<<t1;
return 0;
}
![](https://rs.olm.vn/images/avt/0.png?1311)
a:
#include <bits/stdc++.h>
using namespace std;
long long n,i,a[10000];
int main()
{
cin>>n;
for (i=1;i<=n; i++)
cin>>a[i];
for (i=1; i<=n; i++)
cout<<a[i]<<" ";
return 0;
}
![](https://rs.olm.vn/images/avt/0.png?1311)
Program HOC24;
var d,i,n,x: integer;
t: longint;
a: array[1..32000] of integer;
begin
write('Nhap N: '); readln(n);
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
write('Chi so cac phan tu co gia tri bang 0 la: ');
for i:=1 to n do if a[i]=0 then write(i,' ');
writeln;
d:=0; t:=0;
write('Nhap X: '); readln(x);
for i:=1 to n do if a[i]>x then d:=d+1;
writeln('Co ',d,' phan tu co gia tri lon hon ',x);
if n=20 then
begin
for i:=5 to 20 do t:=t+a[i];
end else write('Du lieu da cho chua du 20 phan tu');
write('Tong cac phan tu co gia tri nam trong doan 5 den 20 la: ',t);
readln
end.
uses crt;
var a:array[1..250]of integer;
i,n,t,x,dem:integer;
begin
clrscr;
write('Nhap n='); readln(n);
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
writeln('Chi so cac phan tu co gia tri bang 0 la: ');
for i:=1 to n do
if a[i]=0 then write(i:4);
writeln;
write('Nhap x='); readln(x);
dem:=0;
for i:=1 to n do
if a[i]>x then inc(dem);
writeln('So phan tu lon hon ',x,' la: ',dem);
t:=0;
for i:=1 to n do
if (5<=a[i]) and (a[i]<=20) then t:=t+a[i];
writeln(t);
readln;
end.
![](https://rs.olm.vn/images/avt/0.png?1311)
program bai1;
uses crt;
var i,j,d:integer;
a:array[1..100]of real;
t,k:real;
begin
clrscr;
i:=1;
while 1/i>0.0321 do
begin
a[i]:=1/i;
inc(i);
d:=i;
end;
writeln('mang tren co ',d,' so hang');
i:=1;
while t+a[i]<=3 do
begin
t:=t+a[i];
inc(i);
end;
writeln('so can tim la: ',a[i+1]:5:4);
writeln(a[i+1]:5:4,' la so hang thu ',i+1);
write('nhap k:');readln(k);
for i:=1 to d do
if (k>a[i])and(k<a[i-1]) then writeln(k:5:4,' nam giua ',a[i]:5:4,' va ',a[i-1]:5:4);
readln;
end.
program bai1;
uses crt;
var i,j,d:integer;
a:array[1..100]of real;
t,k:real;
begin
clrscr;
i:=1;
while 1/i>0.0321 do
begin
a[i]:=1/i;
inc(i);
d:=i;
end;
writeln('mang tren co ',d,' so hang');
i:=1;
while t+a[i]<=3 do
begin
t:=t+a[i];
inc(i);
end;
writeln('so can tim la: ',a[i+1]:5:4);
writeln(a[i+1]:5:4,' la so hang thu ',i+1);
write('nhap k:');readln(k);
for i:=1 to d do
if (k>a[i])and(k<a[i-1]) then writeln(k:5:4,' nam giua ',a[i]:5:4,' va ',a[i-1]:5:4);
readln;
end.
Program HOC24;
var i,j,tong: integer;
t: longint;
a: array[1..2024] of longint;
begin
i:=0; t:=1; a[1]:=1; j:=1;
while i<>2023 do
begin
t:=t+i;
i:=i+1;
j:=j+1;
a[j]:=t;
end;
tong:=0;
for i:=1 to 15 do tong:=tong+a[i];
writeln('Tong 15 so hang dau la: ',tong);
write('So hang thu 2023 la: ',a[2023]);
readln
end.