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.
a)
uses crt;
var a:array[1..100]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(max);
readln;
end.
b)
uses crt;
var a:array[1..100]of integer;
i,n,min:integer;
begin
clrscr;
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(min);
readln;
end.
2:
uses crt;
var a:array[1..100]of integer;
n,i: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]<0 then write(i:4);
readln;
end.
Var z:array[1..1000] of longint;
n, i, max:longint;
Begin
Readln(n);
For i:=1 to n do begin writeln('s',i,'=');
Readln(z[i]);
max:= z[1];
End;
uses crt;
var a:array[1..100]of integer;
i,n,max,dem1,dem2: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('So lon nhat la: ',max);
readln;
end.
uses crt;
var ln,x,i,n:integer;
begin
clrscr;
ln:=MAXINT;
readln(n);
for i:=1 to n do
begin
readln(x);
if ln<x then ln:=x;
end;
write(ln);
readln;
end.
#include <bits/stdc++.h>
using namespace std;
long long x,n,i,dem;
int main()
{
cin>>n;
dem=0;
for (i=1; i<=n; i++)
{
cin>>x;
if (x>5) dem++;
}
cout<<dem;
return 0;
}
#include <bits/stdc++.h>
using namespace std;
int A[100],B[100],C[100],kt,n,nn,dem1=0, dem2=0;
int main()
{
cin>>n;
for (int i=1; i<=n; i++)
cin>>A[i];
kt=0;
nn=INT_MAX;
for (int i=1; i<=n; i++)
if (A[i]%2!=0)
{
kt=1;
if (nn>=A[i]) nn=A[i];
}
if (kt==0) cout<<"khong co";
else cout<<nn;
cout<<endl;
for (int i=1; i<=n; i++)
if (A[i]%2==0 && A[i]>7)
cout<<A[i]<<" ";
cout<<endl;
for (int i=1; i<=n; i++)
if (A[i]%2!=0)
{
dem1++;
B[dem1]=A[i];
}
for (int i=1; i<=n; i++)
if (A[i]%2==0)
{
dem2++;
C[dem2]=A[i];
}
sort(B,B+dem1+1);
sort(C,C+dem2+1);
for (int i=dem1; i>=1; i--)
cout<<B[i]<<" ";
for (int i=1; i<=dem2; i++)
cout<<C[i]<<" ";
}
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 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.
Var a:array[1..1000] of integer;
i,n,max:integer;
Begin
Write('n = ');readln(n);
For i:=1 to n do
Begin
Write('Nhap phan tu thu ',i);readln(a[i]);
End;
max:=a[1];
for i:=2 to n do
if max < a[i] then max:=a[i]
write('So lon nhat trong day la ',max);
Readln
End.