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.

#include <bits/stdc++.h>

using namespace std;

long long a[1000],n,i,dem;

int main()

{

cin>>n;

dem=0;

for (i=1; i<=n; i++)

{

cin>>x;

if ((i%2==1) and (x%2==0)) dem++;

}

cout<<dem;

return 0;

}

16 tháng 11 2021

#include <bits/stdc++.h>

using namespace std;

long long i,n,x;

int main()

{

cin>>n;

for (i=1; i<=n; i++)

{

cin>>x;

if (x==0) cout<<i<<" ";

}

return 0;

}

uses crt;

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

i,n,t,tb:integer;

begin

clrscr;

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 i mod 2=1 then t:=t+a[i];

tb:=0;

for i:=1 to n do 

  tb:=tb+a[i];

writeln('Tong cac phan tu cua day o vi tri le la: ',t);

writeln('Trung binh cong cua day la: ',tb/n:4:2);

readln;

end.

uses crt;

var a,b:array[1..1000]of integer;   

i,n,j,t: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 

begin     

t:=0;     

for j:=1 to i do       

t:=t+a[j];     

b[i]:=t; 

end;

for i:=1 to n do 

write(b[i]:4);

readln;

end.

25 tháng 2 2021

Bọn em học C++ ạ :<<