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 x,n,i,t;

int main()

{

cin>>n;

t=0;

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

{

cin>>x;

t+=x;

}

cout<<t;

return 0;

}

Bài 1: 

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.

Bài 2: 

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.

5 tháng 5 2023

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

i,k:integer;

p:longint;

begin

write('k = ');readln(k);

p:=1;

for i:=1 to k do

begin

write('Nhap so thu ',i,' = ');readln(a[i]);

if a[i]<30 then p:=p*a[i];

end;

write('Tich la ',p);

readln

end.

b) 

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

i,k:integer;

s:longint;

begin

write('k = ');readln(k);

for i:=1 to k do

begin

write('Nhap so thu ',i,' = ');readln(a[i]);

if a[i]<100 then s:=s+a[i];

end;

write('Tong la ',s);

readln

end.

Bài 1: 

#include <bits/stdc++.h>

using namespace std;

long long a[250],i,n,k;

int main()

{

cin>>n>>k;

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

cin>>a[i];

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

if (a[i]==k) cout<<i<<" ";

return 0;

}

26 tháng 2 2021

Program HOC24;

var d,i,n,x: integer;

t: longint;

a: array[1..32000] of integer;

begin

write('Nhap N: '); readln(n);

for i:=1 to n do

begin

write('A[',i,']='); readln(a[i]);

end;

write('Chi so cac phan tu co gia tri bang 0 la: '); 

for i:=1 to n do if a[i]=0 then write(i,' ');

writeln;

d:=0; t:=0;

write('Nhap X: '); readln(x);

for i:=1 to n do if a[i]>x then d:=d+1;

writeln('Co ',d,' phan tu co gia tri lon hon ',x);

if n=20 then

begin

for i:=5 to 20 do t:=t+a[i];

end else write('Du lieu da cho chua du 20 phan tu');

write('Tong cac phan tu co gia tri nam trong doan 5 den 20 la: ',t);

readln

end.

uses crt;

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

i,n,t,x,dem:integer;

begin

clrscr;

write('Nhap n='); readln(n);

for i:=1 to n do 

begin

write('A[',i,']='); readln(a[i]);

end;

writeln('Chi so cac phan tu co gia tri bang 0 la: ');

for i:=1 to n do 

  if a[i]=0 then write(i:4);

writeln;

write('Nhap x='); readln(x);

dem:=0;

for i:=1 to n do 

  if a[i]>x then inc(dem);

writeln('So phan tu lon hon ',x,' la: ',dem);

t:=0;

for i:=1 to n do 

  if (5<=a[i]) and (a[i]<=20) then t:=t+a[i];

writeln(t);

readln;

end.

Câu 1: 

uses crt;

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

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

  t:=t+a[i];

writeln(t);

readln;

end.

Câu 2: 

uses crt;

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

i,n,x,dem,kt:integer;

begin

clrscr;

write('Nhap n='); readln(n);

for i:=1 to n do 

  begin

write('A[',i,']='); readln(a[i]);

end;

write('Nhap x='); readln(x);

kt:=0;

dem:=0;

for i:=1 to n do 

if a[i]=x then 

begin

kt:=1;

write(i:4);

inc(dem);

end;

if kt=0 then writeln('Khong co ',x,' trong day');

writeln(x,' xuat hien ',dem,' lan trong day');

readln;

end.

Bài 1: 

#include <bits/stdc++.h>

using namespace std;

long long a[250],i,n,k;

int main()

{

cin>>n>>k;

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

cin>>a[i];

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

if (a[i]==k) cout<<i<<" ";

return 0;

}

Bài 1: 

#include <bits/stdc++.h>

using namespace std;

long long a[250],i,n,k;

int main()

{

cin>>n>>k;

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

cin>>a[i];

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

if (a[i]==k) cout<<i<<" ";

return 0;

}