K
Khách

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 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.

#include <bits/stdc++.h>

using namespace std;

long long a[10000],i,n;

int main()

{

cin>>n;

for (i=1; i<=n; i++) cin>>a[i];

for (i=1; i<=n; i++) cout<<a[i]<<"     ";

cout<<endl;

t=0;

for (i=1; i<=n; i++) if (a[i]%2==0) t+=a[i];

cout<<"Tong cac so chan la: "<<t<<endl;

sort(a+1,a+n+1);

cout<<"Day so giam dan la: ";

for (i=n; i>=1; i--) cout<<a[i]<<" ";

return 0;

}

25 tháng 2 2022

Nhưng mà cái này dùng theo pascal và theo kiểu mảng ạ

19 tháng 12 2021

#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;

}

18 tháng 12 2021

#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;

}

6 tháng 1 2022

Program HOC24;

var i,n: byte;

A: array[1..100] 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 la: ',t);

readln

end.

2 tháng 8 2017

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.

uses crt;

var a:array[1..100]of integer;

i,n,t:integer;

begin

clrscr;

readln(n);

for i:=1 to n do readln(a[i]);

for i:=1 to n do write(a[i]:4);

writeln;

t:=0;

for i:=1 to n do 

  if a[i] mod 2=0 then t:=t+a[i];

writeln(t);

readln;

end.

30 tháng 12 2021

#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;

}