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;

const fi='ketqua.out';

var f1:text;

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

i,n,min:integer;

begin

clrscr;

assign(f1,fi); rewrite(f1);

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

for i:=1 to n do 

begin

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

end;

min:=a[1];

for i:=1 to n do 

  if min>a[i] then min:=a[i];

writeln(f1,min);

close(f1);

readln;

end.

Bài 1: 

uses crt;

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

i,n,min:integer;

begin

clrscr;

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

for i:=1 to n do 

begin

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

end;

min:=a[1];

for i:=1 to n do 

if min>a[i] then min:=a[i];

writeln(min);

readln;

end.

Bài 2: 

uses crt;

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

i,n,max:integer;

begin

clrscr;

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

for i:=1 to n do 

begin

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

end;

max:=a[1];

for i:=1 to n do 

 if max<a[i] then max:=a[i];

writeln(max);

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.

#include <bits/stdc++.h>

using namespace std;

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

int main()

{

cin>>n;

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

sort(a+1,a+n+1);

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

{

int x=sqrt(a[i]);

if (x*x==a[i]) 

{

cout<<x;

return 0;

}

}

cout<<"Ko co so chinh phuong trong day";

return 0;

}

21 tháng 1 2022

uses crt;
var x,i,max,n,dem,dem1,dem2,dem3,t,t1:integer;
a,b,c,d,e:array[-32000..32000]of integer;
tbca,tbcd:real;
begin
clrscr;
write(‘n=’); readln(n);
for i:=1 to n do
begin
write(‘a[‘,i,’]=’); readln(a[i]);
inc(b[a[i]]);
end;
{———————————-cau-a—————————-}
max:=0;
for i:=1 to n do
if max<b[a[i]] then
begin
max:=b[a[i]];
x:=a[i];
end;
writeln(‘phan tu co so lan xuat hien nhieu nhat trong mang la: ‘,x);
{——————————–cau-b——————————-}
dem:=0;
for i:=1 to n do
if a[i]>=0 then
begin
dem:=dem+1;
c[dem]:=a[i];
end;
dem1:=0;
for i:=1 to dem do
if trunc(sqrt(c[i]))=sqrt(c[i]) then inc(dem1);
writeln(‘so luong so chinh phuong trong day la: ‘,dem1);
{——————————–cau-c—————————–}
dem2:=0;
dem3:=0;
for i:=1 to n do
begin
if a[i]>0 then
begin
inc(dem2);
d[dem2]:=a[i];
end;
if a[i]<0 then
begin
inc(dem3);
e[dem3]:=a[i];
end;
end;
t:=0;
t1:=0;
for i:=1 to dem2 do
t:=t+d[i];
tbcd:=t/dem2;
for i:=1 to dem3 do
t1:=t1+e[i];
tbca:=t1/dem3;
writeln(‘trung binh cong cac so am la: ‘,tbca:4:2);
writeln(‘trung binh cong cac so duong la: ‘,tbcd:4:2);
readln;
end.

25 tháng 7 2021

cau 1:

uses crt;

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

n,i,min: integer;

begin

readln(n);

for i:=1 to n do

readln(a[i]);

min:=a[1];

for i:=2 to n do

if min>a[i] then min=a[i];

writeln(a[i]);

readln;

end.

cau 2:

uses crt;

g:text;

s:string;

const fo='CHUSO.TXT';

begin

assign(g,fo);

rewrite(g);

readln(s);

for i:=1 to length(s) do

if not((s[i] in ['a'..'z'])and(s[i] in ['A'..'Z])) then delete(s,i,1);

writeln(g,s);

end.

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.

10 tháng 4 2023

Uses crt;

var max,min,n,i,m,n: longint;

a: array[1..100] of longint

begin clrscr;

for i:=1 to n do begin

if(a[i] mod 2=0) then m:=m+a[i];

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

end;

max:=a[1];

min:=a[1];

for i:=1 to n do begin

if(max<a[i]) then max:=a[i];

if(min>a[i]) then min:=a[i];

end;

Writeln('Tong cac phan tu chan: ',m);

Writeln('Tong cac phan tu le: ',n);

Writeln('Phan tu co gia tri lon nhat: ',max);

Writeln('Phan tu co gia tri nho nhat: ',min);

readln;

end.

11 tháng 4 2023

Uses crt;

var max,min,n,i,m,n: longint;

a: array[1..100] of longint

begin clrscr;

for i:=1 to n do begin

if(a[i] mod 2=0) then m:=m+a[i];

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

end;

max:=a[1];

min:=a[1];

for i:=1 to n do begin

if(max<a[i]) then max:=a[i];

if(min>a[i]) then min:=a[i];

end;

Writeln('Tong cac phan tu chan: ',m);

Writeln('Tong cac phan tu le: ',n);

Writeln('Phan tu co gia tri lon nhat: ',max);

Writeln('Phan tu co gia tri nho nhat: ',min);

readln;

end.

uses crt;

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

i,n,t,ln,nn:integer;

begin

clrscr;

readln(n);

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

ln:=a[1];

nn:=a[1];

t:=0;

for i:=1 to n do 

begin

if ln<a[i] then ln:=a[i];

if nn>a[i] then nn:=a[i];

t:=t+a[i];

end;

writeln(ln);

writeln(nn);

writeln(t);

for i:=1 to n do 

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

readln;

end.

25 tháng 5 2022

var n,i,max,min,s: integer;

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

begin

readln(n);

for i:=1 to n do begin

readln(a[i]);

s:=s+a[i];

end;

max:=a[1]; min:=a[1];

for i:=2 to n do begin

if max<a[i] then max:=a[i];

if min>a[i] then min:=a[i];

end;

writeln('MAX=',max,'  | MIN=',min);

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

write('Tong = ',s);

readln

end.