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.
Program HOC24;
var n,i: integer;
a: array[1..32000] of integer;
t: longint;
begin
write('Nhap N: '); readln(n);
write('Nhap so thu ',i,': '); readln(a[i]);
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.
uses crt;
var n,i,t:integer;
begin
clrscr;
readln(n);
t:=0;
for i:=1 to n do
if i mod 2=0 then t:=t+i;
write(t);
readln;
end.
#include <bits/stdc++.h>
using namespace std;
long long i,n,s;
int main()
{
cin>>n;
s=1;
for (i=1; i<=n; i++) if (i%2==0) s*=i;
cout<<s;
return 0;
}
program HienThiSoChan;
var
N, i: integer;
A: array[1..50] of integer;
begin
writeln('Nhap so nguyen duong N:');
readln(N);
writeln('Nhap day so A gom ', N, ' phan tu:');
for i := 1 to N do
begin
readln(A[i]);
if A[i] mod 2 = 0 then
begin
writeln('Phan tu thu ', i, ' la so chan: ', A[i]);
end;
end;
readln;
end.
program BaiTap;
var
A: array[1..150] of integer;
N, i, sum: integer;
begin
write('Nhap so phan tu cua day A (N <= 150): ');
readln(N);
for i := 1 to N do
begin
write('Nhap phan tu thu ', i, ': ');
readln(A[i]);
end;
writeln('Day so vua nhap la:');
for i := 1 to N do
write(A[i], ' ');
writeln;
sum := 0;
for i := 1 to N do
if A[i] mod 2 = 0 then
sum := sum + A[i];
writeln('Tong cac phan tu chan trong day la: ', sum);
readln;
end.
uses crt;
var a:array[1..100]of integer;
i,n: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
if a[i] mod 2=0 then write(a[i]:4);
readln;
end.
uses crt;
var a:array[1..1000000] of longint;
n,i:longint;
begin
clrscr;
write('Nhap so luong phan tu: '); readln(n);
for i:=1 to n do
begin
write('Nhap phan tu thu ',i,': '); readln(a[i]);
end;
write('Cac so chan: ');
for i:=1 to n do if a[i] mod 2=0 then write(a[i],' ');
readln;
end.
uses crt;
var i,n:integer;
begin
clrscr;
write('n='); readln(n);
writeln('cac so chan trong khoang tu 1 toi ',n,' la:');
for i:=1 to n do
if i mod 2=0 then write(i:4);
readln;
end.