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%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 2 = 0 then Tong:= Tong+i;
Writeln(‘Tong la:’,Tong);
Readln
End.
#include <bits/stdc++.h>
using namespace std;
long long m,n,i;
int main()
{
cin>>m>>n;
for (i=m; i<=n; i++)
if (i%2==1) cout<<i<<" ";
return 0;
}
#include <bits/stdc++.h>
using namespace std;
long long a,b,i,dem,s;
int main()
{
cin>>a>>b;
dem=0;
s=0;
for (i=a; i<=b; i++)
if (i%2==0)
{
dem++;
s=s+i;
}
cout<<dem<<" "<<s;
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 2 = 1 then Tong:= Tong+i;
Writeln(‘Tong la:’,Tong);
Readln
End.
#include <bits/stdc++.h>
using namespace std;
long long a,b,i,dem,s;
int main()
{
cin>>a>>b;
dem=0;
s=0;
for (i=a; i<=b; i++)
if (i%2==0)
{
dem++;
s=s+i;
}
cout<<dem<<" "<<s;
return 0;
}
Program HOC24;
var i,n: integer;
a: array[1..200] 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 2=0 then t:=t+a[i];
write('Tong cac so chan trong mang la: ',t);
readln
end.
#include <bits/stdc++.h>
using namespace std;
long long a[1000],n,i,dem,t,j,t1;
int main()
{
cin>>n;
for (i=1; i<=n; i++) cin>>a[i];
for (i=1; i<=n; i++) cout<<a[i]<<" ";
cout<<endl;
dem=0;
for (i=1; i<=n; i++)
{
t=0;
for (j=1; j<=a[i]-1; j++)
if (a[i]%j==0) t+=j;
if (t==a[i]) dem++;
}
cout<<dem<<endl;
t1=0;
for (i=1; i<=n; i++)
if (a[i]%2==0) t1+=a[i];
cout<<t1;
return 0;
}
#include <bits/stdc++.h>
using namespace std;
long long a,b,i,dem,s;
int main()
{
cin>>a>>b;
dem=0;
s=0;
for (i=a; i<=b; i++)
if (i%2==0)
{
dem++;
s=s+i;
}
cout<<dem<<" "<<s;
return 0;
}
uses crt;
var m,n,t,i:integer;
begin
clrscr;
write('Nhap m='); readln(m);
write('Nhap n='); readln(n);
t:=0;
for i:=m to n do
if i mod 2=0 then t:=t+i;
writeln('Tong cac so chan tu ',m,' den ',n,' la: ',t);
readln;
end.