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.
Bai 2:
uses crt;
var a:array[1..100]of integer;
i,n,t,nn:integer;
begin
clrscr;
readln(n);
for i:=1 to n do readln(a[i]);
nn:=a[1];
for i:=1 to n do
if nn>a[i] then nn:=a[i];
write(nn);
readln;
end.
uses crt;
var a:array[1..100]of integer;
i,n,dem,k:integer;
begin
clrscr;
write('Nhap n='); readln(n);
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]=k then inc(dem);
writeln('Trong day co ',dem,' phan tu co gia tri bang ',k);
readln;
end.
uses crt;
var A : array [1 .. 10] of integer;
i, n, d : integer;
begin
clrscr;
d := 0;
write('Nhap so luong phan tu : '); readln(n);
for i := 1 to n do
begin
write('Nhap so thu ', i ,' : ');
readln(A[i]);
if A[i] mod 2 = 0 then
d := d + 1;
end;
write('Cac phan tu vua nhap : ');
for i := 1 to n do write(A[i],' ');
writeln; write('Day co ', d ,' so chan ');
readln
end.
Program bt;
Uses crt;
Var a:array [1..1000] of integer;
n,i: integer;
Begin
Write( 'Moi 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( 'Cac so chan la',a[i]);
Readln;
End.
uses crt;
var A : array [1 .. 10] of integer;
i, n, d : integer;
begin
clrscr;
d := 0;
write('Nhap so luong phan tu : '); readln(n);
for i := 1 to n do
begin
write('Nhap so thu ', i ,' : ');
readln(A[i]);
if A[i] mod 2 = 0 then
d := d + 1;
end;
write('Cac phan tu vua nhap : ');
for i := 1 to n do write(A[i],' ');
writeln; write('Day co ', d ,' so chan ');
readln
end.
#include <bits/stdc++.h>
using namespace std;
long long a[1000],i,n,t,dem;
int main()
{
cin>>n;
for (i=1; i<=n; i++) cin>>a[i];
t=0;
dem=0;
for (i=1; i<=n; i++)
if ((a[i]>0) and (i%2==1))
{
t+=a[i];
dem++;
}
cout<<fixed<<setprecision(2)<<(t*1.0)/(dem*1.0);
return 0;
}
uses crt;
var a:array[1..200]of integer;
i,n,max:integer;
begin
clrscr;
write('Nhap 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('Gia tri lon nhat la: ',max);
write('Vi tri la: ');
for i:=1 to n do
if max=a[i] then write(i:4);
readln;
end.