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.

22 tháng 7 2021

uses crt;

Var i,n,dem:integer;

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

Begin

clrscr;

Write('Nhap do dai cua day: ');readln(n);

dem:=0;

for i:= 1 to n do

  Begin

  write('So thu ',i,' = ');

  readln(a[i]);

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

  end;

Writeln('Day so co ',dem,' so chan');

readln;

End.

6 tháng 8 2021

uses crt;

var i,n,dem:longint;a:array[1..1000]of longint;

begin

clrscr;

write('nhap so phan tu cua day:');readln(n);

for i:=1 to n do

begin

write('nhap phan tu thu',i,'=');readln(a[i]);

end;

for i:=1 to n do if(a[i] mod 2=0)then inc(dem);

writeln('co tat ca:',dem,'so chan');

readln;

end.

 

uses crt;

var st:string;   

d,i,dem:integer;

begin

clrscr;

write('Nhap xau:'); readln(st);

d:=length(st);

while st[1]=#32 do 

begin     

delete(st,1,1);     

d:=length(st); 

end;

while st[d]=#32 do 

begin     

delete(st,d,1);     

d:=length(st); 

end;

for i:=1 to d do 

begin     

while (st[i]=#32) and (st[i+1]=#32) do       

begin         

delete(st,i,1);         

d:=length(st);       

end; 

end;

st[1]:=upcase(st[1]);

for i:=1 to d do 

if st[i]=#32 then st[i+1]:=upcase(st[i+1]);

writeln('Ten cua ban sau khi viet dung la: ',st);

dem:=1;

for i:=1 to d do 

if st[i]=#32 then inc(dem);

writeln('So tu cua xau la: ',dem);

readln;

end.

19 tháng 2 2023

Bài 1:

Program HOC24;

var i,n,d : byte;

t: integer;

begin

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

for i:=1 to n do 

begin

write('Nhap phan tu thu ',i,' : '); readln(a[i]);

end;

for i:=1 to n do if (a[i] mod 3=0) and (a[i] mod 5=0) then

begin

d:=d+1;

t:=t+a[i];

end;

writeln('Co ',d,' phan tu la boi cua 3 va 5');

write('Tong la: ',t);

readln

end.

19 tháng 2 2023

Bài 2:

Program HOC24;

var i,n,k : byte;

begin

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

for i:=1 to n do 

begin

write('Nhap phan tu thu ',i,' : '); readln(a[i]);

end;

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

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

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

Write('Cac chi so do la: ');

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

readln

end.

13 tháng 3 2021

Program HOC24;

var a,b,c,d,max: integer;

t: longint;

begin

write('Nhap a; b; c; d: '); readln(a,b,c,d);

t:=a+b+c+d;

writeln('Tong 4 so tren la: ',t); 

max:=a;

if max<b then max:=b;

if max<c then max:=c;

if max<d then max:=d;

write('So lon nhat cua chung la: ',max);

readln

end.

*Cách khác:

uses crt;

var a,b,c,d,max:integer;

begin

clrscr;

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

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

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

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

writeln('Tong cua 4 so la: ',a+b+c+d);

max:=a;

if max<b then max:=b;

if max<c then max:=c;

if max<d then max:=d;

writeln('Gia tri lon nhat la: ',max);

readln;

end.

uses crt;

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

i,n,dem,dem1,dem2,t:integer;

s:real;

begin

clrscr;

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

for i:=1 to n do 

begin

repeat

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

until a[i]>0;

end;

for i:=1 to n do 

  write(a[i]:4);

writeln;

dem:=0;

for i:=1 to n do

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

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

dem1:=0;

dem2:=0;

for i:=1 to n do 

begin

if a[i] mod 2=0 then inc(dem1)

else inc(dem2);

end;

writeln('So luong so chan la: ',dem1);

writeln('So luong so le la: ',dem2);

t:=0;

s:=1;

for i:=1 to n do 

  begin

if (i mod 2=0) and (a[i] mod 2<>1) then t:=t+a[i];

if (i mod 2=1) and (a[i] mod 2=0) then s:=s*a[i];

end;

writeln('Tong cac so o vi tri chan co gia tri le la: ',t);

writeln('Tich cac so o vi tri le co gia tri chan la: ',s:4:2);

writeln('Cac so le la: ');

for i:=1 to n do 

  if a[i] mod 2<>0 then write(a[i]:4);

writeln;

writeln('Cac so chan va lon hon 10 la: ');

for i:=1 to n do 

  if (a[i] mod 2=0) and (a[i]>10) then write(a[i]:4);

readln;

end.

18 tháng 2 2021

Thank you

10 tháng 4 2021

Program HOC24;

var d,i,n: integer;

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

t: longint;

function nt(x: longint): boolean;

var j: longint;

begin

nt:=true;

if (x=2) or (x=3) then exit;

nt:=false;

if (x=1) or (x mod 2=0) or (x mod 3=0) then exit;

j:=5;

while j<=trunc(sqrt(x)) do

begin

if (x mod j=0) or (x mod (j+2)=0) then exit;

j:=j+6;

end;

nt:=true;

end;

begin

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

for i:=1 to n do

begin

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

end;

d:=0; t:=0;

for i:=1 to n do

if nt(a[i]) then

begin

d:=d+1;

t:=t+a[i];

end;

writeln('Co ',d,' so nguyen to trong day');

write('Tong cac so nguyen to trong day la: ',t);

readln

end.

uses crt;

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

i,n,dem,t,j,kt:integer;

begin

clrscr;

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

for i:=1 to n do 

  begin

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

end;

dem:=0;

t:=0;

for i:=1 to n do 

  if a[i]>1 then 

begin

kt:=0;

for j:=2 to a[i]-1 do 

 if a[i] mod j=0 then kt:=1;

if kt=0 then

begin

inc(dem);

t:=t+a[i];

end;

end;

writeln('So luong so nguyen to la: ',dem);

writeln('Tong cac so nguyen to la: ',t);

readln;

end.

24 tháng 2 2022

bạn tham khảo:

undefined

undefined

Theo C++ nhé bạn

Codeblacks 

uses crt;

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

i,n,dem:integer;

begin

clrscr;

for i:=1 to 10 do 

  begin

repeat

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

until a[i]>0;

end;

writeln('Day so vua nhap la: ');

for i:=1 to 10 do 

  write(a[i]:4);

dem:=0;

for i:=1 to n do 

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

writeln;

writeln('So luong so chan la: ',dem);

readln;

end.

#include <bits/stdc++.h>

using namespace std;

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

bool kt;

{

cin>>n;

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

cin>>m;

kt=false;

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

if (a[i]==m) kt=true;

if (kt==true) cout<<"Co";

else cout<<"Khong";

return 0;

}

12 tháng 2 2022

Thíu nhìu lém hén😂