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;
int t,i;
int main()
{
t=0;
for (i=1; i<=20; i++)
if ((i%3==0) and (i%2==1)) t=t+i;
cout<<t;
return 0;
}
Program bt_3;
Uses crt;
Var Tong, n, i: integer;
Begin
Clrscr;
Writeln(‘nhap n=’);
Readln (n);
Tong:=0;
For i:=1 to n do
If I mod 5 = 0 then Tong:= Tong+i;
Writeln(‘Tong la:’,Tong);
Readln
End.
Program bt_3;
Uses crt;
Var Tong, n, i: integer;
Begin
Clrscr;
Writeln(‘nhap n=’);
Readln (n);
Tong:=0;
For i:=1 to n do
If I mod 3 = 0 then Tong:=Tong+i;
Writeln(‘Tong la:’,Tong);
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%2==1) t=t+i;
cout<<t;
return 0;
}
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 = 1 then Tong:= Tong+i;
write(f2, Tong);
close(f1);
close(f2);
End.
Program HOC24;
var m,n,i: integer;
t1,t2: longint;
begin
write('Nhap m;n: '); readln(m,n);
t1:=1; t2:=1;
for i:=1 to n do t1:=t1*i;
for i:=m to n do t2:=t2*i;
writeln('T1=',t1);
write('T2=',t2);
readln
end.
Program bt_3;
Uses crt;
Var Tong, n, i: integer;
Begin
Clrscr;
Writeln(‘nhap n=’);
Readln (n);
Tong:=0;
For i:=1 to n do
If I mod 2 = 1 then Tong:= Tong+i;
Writeln(‘Tong la:’,Tong);
Readln
End.
Câu 2:
uses crt;
var a:array[1..100]of integer;
i,n,min,dem1,dem2,t1,t2:integer;
begin
clrscr;
write('Nhap n='); readln(n);
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
max:=a[1];
for i:=1 to n do
if max<a[i] then max:=a[i];
writeln('Gia tri lon nhat la: ',max);
dem1:=0;
dem2:=0;
t1:=0;
t2:=0;
for i:=1 to n do
begin
if a[i] mod 2=0 then
begin
inc(dem1);
t1:=t1+a[i];
end
else begin
inc(dem2);
t2:=t2+a[i];
end;
end;
writeln('So so chan la: ',dem1);
writeln('So so le la: ',dem2);
writeln('Tong cac so chan la: ',t1);
writeln('Tong cac so le la: ',t2);
readln;
end.
Câu 1:
const fi='dulieu.inp';
fo='ketqua.out';
var f1,f2:text;
m,n,t,i:integer;
begin
assign(f1,fi); reset(f1);
assign(f2,fo); rewrite(f2);
readln(f1,m,n);
t:=0;
for i:=m to n do
if i mod 2=1 then t:=t+i;
writeln(f2,t);
close(f1);
close(f2);
end.
#include <bits/stdc++.h>
using namespace std;
long long m,n,t,i;
int main()
{
freopen("dulieu.inp","r",stdin);
freopen("ketqua.out","w",stdout);
cin>>m>>n;
t=0;
for (i=m; i<=n; i++)
if (i%2!=0) t+=i;
cout<<t;
return 0;
}
#include <bits/stdc++.h>
using namespace std;
long long i,m,t;
int main()
{
cin>>m;
t=0;
for (i=1; i<=m; i++)
if ((i%2!=0) and (i%7==0)) t=t+i;
cout<<t;
return 0;
}