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 1:
uses crt;
var a:array[1..200]of integer;
i,n,t: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
if a[i] mod 5=0 then t:=t+a[i];
writeln('Tong cac so chia het cho 5 la: ',t);
readln;
end.
Bài 2:
uses crt;
var st:string;
d,i:integer;
begin
clrscr;
write('Nhap xau:'); readln(st);
d:=length(st);
for i:=1 to d do
if st[i]=#32 then delete(st,i,1);
writeln(st);
readln;
end.
#include <bits/stdc++.h>
using namespace std;
long long n,i,x,dem,t;
int main()
{
cin>>n;
dem=0;
t=0;
for (i=1; i<=n; i++)
{
cin>>x;
if (x%3==0)
{
dem++;
t+=x;
}
}
cout<<dem<<" "<<t;
return 0;
}
uses crt;
var a:array[1..100]of integer;
i,n,dem,s,s1,vt:integer;
begin
clrscr;
write('Nhap n='); readln(n);
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
dem:=0;
s:=1;
for i:=1 to n do
if a[i]=3 then
begin
inc(dem);
s:=s*a[i];
end;
writeln('So phan tu bang 3 la: ',dem);
writeln('Tich cua chung la: ',s);
for i:=n downto 1 do
if a[i]<0 then
begin
vt:=i;
break;
end;
if vt=0 then writeln('Trong day khong co so am')
else writeln('So am cuoi cung la: ',a[vt]);
s1:=1;
for i:=1 to n do
if (a[i] mod 3=0) or (a[i] mod 4=0) then s1:=s1*a[i];
writeln('Tich cac phan tu chia het cho 3 hoac 4 la: ',s1);
writeln('Cac so nguyen la: ');
for i:=1 to n do
write(a[i]:4);
readln;
end.
#include <bits/stdc++.h>
using namespace std;
long long n,i,t,dem;
int main()
{
cin>>n;
t=0;
dem=0;
for (i=1; i<=n; i++)
if (i%3==0)
{
t=t+i;
dem++;
}
cout<<t<<endl;
cout<<fixed<<setprecision(2)<<(t*1.0)/(dem*1.0);
return 0;
}
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 inc(dem);
writeln(dem);
readln;
end.
Program HOC24;
var i,n: integer;
a: array[1..10000] of integer;
t: longint;
begin
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 if (a[i] mod 3=0) and (a[i] mod 5=0) then t:=t+a[i];
write('Tong la: ',t);
readln
end.
#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];
for (i=1; i<=n; i++)
if (a[i]%3==0) t+=a[i];
cout<<t;
return 0;
}
lớp 11???
#include <bits/stdc++.h>
using namespace std;
long long x,i,n,dem;
int main()
{
cin>>n;
dem=0;
for (i=1; i<=n; i++)
{
cin>>x;
if ((x%2==0) or (x%5==0)) dem++;
}
cout<<dem;
return 0;
}