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.
uses crt;
var a:array[1..100]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;
for i:=1 to n do
write(a[i]:4);
writeln;
t:=0;
for i:=1 to n do
if a[i] mod 7=0 then t:=t+a[i];
writeln('Tong cac so chia het cho 7 la: ',t);
readln;
end.
#include <bits/stdc++.h>
using namespace std;
long long m,n,i,t;
int main()
{
cin>>m>>n;
t=0;
for (i=m; i<=n; i++)
if (i%15==0) t=t+i;
cout<<t;
return 0;
}
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.
Var i,n:integer;
s:longint;
Begin
Write('n = ');readln(n);
For i:=1 to n-1 do
If (i mod 2 = 0) and (i mod 3 = 0) then
s:=s + i;
Write('Tong la ',s);
Readln;
End.
uses crt;
var a:array[1..200]of integer;
n,i,k,t,t1:integer;
begin
clrscr;
write('Nhap n='); readln(n);
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
write('Nhap k='); readln(k);
t:=0;
for i:=1 to n do
if a[i] mod 2<>0 then t:=t+a[i];
t1:=0;
for i:=1 to n do
if a[i] mod k=0 then t1:=t1+a[i];
writeln('Tong cac phan tu le la: ',t);
writeln('Tong cac phan tu la boi cua ',k,' la: ',t1);
readln;
end.
#include <bits/stdc++.h>
using namespace std;
long long i,n,dem;
int main()
{
cin>>n;
dem=0;
for (i=1; i<=n; i++)
if (i%2==1 && i%5==0) dem++;
cout<<dem;
return 0;
}
Bài 2:
#include <bits/stdc++.h>;
using namespace std;
int main();
{
long m,n;
cout<<"Nhap m="; cin>>m;
cout<<"Nhap n="; cin>>n;
cout<<m*n-2;
return 0;
}
Câu 1:
#include <bits/stdc++.h>
using namespace std;
long long n;
int main()
{
cin>>n;
int t=0;
while (n>0)
{
int x=n%10;
t=t+x;
n=n/10;
}
cout<<t;
return 0;
}
uses crt;
var n,i,t:integer;
begin
clrscr;
repeat
write('Nhap n='); readln(n);
until n>0;
t:=0;
for i:=1 to n do
if i mod 3=0 then t:=t+i;
writeln('Tong cac so chia het cho 3 trong khoang tu 1 toi ',n,' la: ',t);
readln;
end.