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 x,n,i,t;
int main()
{
cin>>n;
t=0;
for (i=1; i<=n; i++)
{
cin>>x;
if (x%2!=0) t+=x;
}
cout<<t;
return 0;
}
Var a:array[1..200] of integer;
i,n:integer;
s:longint;
Begin
Write('Nhap so luong so ');readln(n);
For i:=1 to n do
Begin
Write('Nhap so thu ',i,' = ');readln(a[i]);
End;
Writeln('Cac so vua nhap la ');
For i:=1 to n do write(a[i]:6);
Writeln;
Write('Tong la ');
For i:=1 to n do s:=s+a[i];
Write(s);
Readln;
End.
Mảng table có 25 phần tử. Vì:
0..Columns + 1 = 0..3+1 = 4. Từ 0 đến 4 có 5 phần từ
0..Row = 0..4. Từ 0 đến 4 có 5 phần tử
=> mảng table có 25 phần tử
minh ghi bị nhầm cho dãy A gồm N số nguyên a1, a2...aN . trong dãy A có bao nhiêu phần tử là số lẻ , tính tống các phần tử lẽ đó.
var s,a1,an,n,c:integer;
begin
s:=0;
c:=0
write('nhap a1,an ');
read(n);
for i:=a1 to an do
if i mod 2=0 then
begin
s:=s+i;
c:=c+1;
end;
write ('so so thoa ycdb la : ',c);
write ('tong so thoa ycdb la : ',s);
readln
end.
#include <bits/stdc++.h>
using namespace std;
long long a[1000],n,i;
int main()
{
cin>>n;
for (i=1; i<=n; i++)
cin>>a[i];
for (i=1; i<=n; i++)
if (a[i]==0)
{cout<<i; break; }
return 0;
}

program UCLN_BCNN_TichMang;
uses math;
var
n, m, i: integer;
a, b: array[1..100] of int64;
tichA, tichB: int64;
ucln, bcnn: int64;
function GCD(x, y: int64): int64;
begin
while y <> 0 do
begin
x := x mod y;
x := x + y;
y := x - y;
x := x - y;
end;
GCD := x;
end;
begin
readln(n);
for i := 1 to n do
read(a[i]);
readln(m);
for i := 1 to m do
read(b[i]);
tichA := 1;
for i := 1 to n do
tichA := tichA * a[i];
tichB := 1;
for i := 1 to m do
tichB := tichB * b[i];
ucln := GCD(tichA, tichB);
bcnn := (tichA div ucln) * tichB;
writeln('UCLN = ', ucln);
writeln('BCNN = ', bcnn);
end.