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;
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;
}
uses crt;
var m,n,dem,i:integer;
begin
clrscr;
write('nhap m='); readln(m);
write('nhap n='); readln(n);
if (m>0) and (n>0) then
begin
if m<n then
begin
dem:=0;
for i:=m to n do
if (i mod 2=1) then
begin
if (i mod 3<>0) or (i mod 5<>0) then inc(dem);
end;
writeln('so luong cac so le khong chia het cho 3 hoac 5 trong pham vi tu ',m,' toi ',n,' la: ',dem);
end
else writeln('vui long nhap m lon hon n');
end
else writeln('vui long nhap so lon hon 0');
readln;
end.
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.
Var f1, f2: text;
Tong, m, n, i: integer;
Begin
assign(f1, ‘DULIEU.TXT’);
reset(f1);
assign(f2, ‘KETQUA’);
rewrite(f2);
Tong;= 0;
read(f1, m, n);
for i:= m to n do
if i mod 2 = 0 then Tong:= Tong+i;
write(f2, Tong);
close(f1);
close(f2);
End.
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.
#include <bits/stdc++.h>
using namespace std;
long long m,n,i,dem;
int main()
{
cin>>m>>n;
dem=0;
for (i=m; i<=n; i++)
if ((I%3==0) or (i%5==0)) dem++;
cout<<dem;
return 0;
}
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.
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.
quá dễ
uses crt;
var m,n,i,t,t1:integer;
begin
clrscr;
repeat
write('m='); readln(m);
write('n='); readln(n);
if m>=n then writeln('ban da nhap sai, yeu cau ban nhap lai');
until m<n;
t:=0;
t1:=0;
for i:=m to n do
begin
if (i>=10) and (i mod 3=0) then t:=t+i;
if (i>=10) and (i mod 2=0) then t1:=t1+i;
end;
writeln('tong cac so co 2 chu so chia het cho 3 trong khoang tu ',m,' toi ',n,' la: ',t);
writeln('tong cac so co 2 chu so chia het cho 2 trong khoang tu ',m,' toi ',n,' la: ',t1);
readln;
end.