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 n,k,i,dem:integer;

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

begin

clrscr;

readln(n,k);

for i:=1 to n do 

readln(a[i]);

dem:=0;

for i:=1 to n do 

  if a[i]>k then dem:=dem+1;

writeln(dem);

readln;

end.

uses crt;

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

i,n,k,dem:integer;

begin

clrscr;

readln(n);

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

readln(k);

dem:=0;

for i:=1 to n do

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

write(dem);

readln;

end.

17 tháng 4 2023

python hay pascal

1 tháng 3 2023

Program HOC24;

var i,d,n: integer;

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('Nhap k: '); readln(k);

d:=0;

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

write('Co ',d,' phan tu bang ',k);

readln

end.

uses crt;

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

i,n,dem,t:integer;

begin

clrscr;

repeat

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

until (0<n) and (n<=1000);

for i:=1 to n do 

begin

repeat

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

until abs(a[i])<=1000;

end;

for i:=1 to n do 

  write(a[i]:4);

writeln;

dem:=0;

for i:=1 to n do 

  if a[i]=0 then inc(dem);

writeln('So phan tu bang 0 la: ',dem);

t:=0;

for i:=1 to n do 

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

writeln('Tong cac phan tu chan la: ',t);

readln;

end. 

31 tháng 12 2022

#include <bits/stdc++.h>

using namespace std;

int n,A[100],i,k,t;

int main()

{

cin>>n>>k;

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

t=0;

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

if (A[i]%k==0) t+=A[i];

cout<<t;

}

#include <bits/stdc++.h>

using namespace std;

long long n,i,x,t;

int main()

{

cin>>n;

t=0;

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

{

cin>>x;

if (x<0) t+=x;

}

cout<<t;

return 0;

}

1 tháng 1 2021

var n,i,k,d: integer;

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

begin

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

for i:=1 to n do

begin

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

end;

write('Nhap so k: '); readln(k);

d:=0;

for i:=1 to n do

if a[i] mod k = 0 then d:=d+1;

writeln('Co ',d,' so chia het cho ',k,' trong day');

if d mod 2 = 0 then writeln('Chan') else writeln('Le');

end.

uses crt;

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

i,n,k,dem:integer;

begin

clrscr;

repeat

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

until (0<n) and (n<=52);

for i:=1 to n do 

  begin

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

end;

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

dem:=0;

for i:=1 to n do  

  if a[i] mod k=0 then inc(dem);

writeln('Trong day co ',dem,' so chia het cho ',k);

if dem mod 2=0 then writeln('So luong so chia het cho ',k,' la so chan')

else writeln('So luong so chia het cho ',k,' la so le');

readln;

end.

17 tháng 12 2022

var n,i,dem,t:integer;
a:array[1..50] of integer;
begin
    dem:=0;
    t:=0;
    read(n);
    for i:=1 to n do 
    read(a[i]);
    for i:=n downto 1 do
    write(a[i]);
    writeln;
    for i:=1 to n do 
    if (a[i] mod 2 = 0) then dem:=dem+1;
    if a[i]<a[i-1] then t:=t+1;
    writeln(dem);
    if t=0 then write('Co lap thanh cap so +')
    else write('Ko the lap thanh cap so +');
    readln;
end.

uses crt;

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

i,n,dem1,dem2: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;

dem1:=0;

for i:=1 to n do 

  if (a[i]>a[i-1]) and (a[i]>a[i+1]) then dem1:=dem1+1;

dem2:=0;

for i:=1 to n do 

  if (a[i]<a[i-1]) and (a[i]<a[i+1]) then dem2:=dem2+1;

writeln(dem1);

writeln(dem2);

readln;

end.

#include <bits/stdc++.h>

using namespace std;

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

int main()

{

cin>>n;

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

cin>>k;

dem=0;

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

if (a[i]==k) dem++;

cout<<dem;

return 0;

}