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='kiemtra.txt';
var f1:text;
a:array[1..100]of integer;
min,n,i:integer;
{----------------chuong-trinh-con-------------------}
function nn(x,y:integer):integer;
begin
if x<y then nn:=x
else nn:=y;
end;
{-----------------chuong-trinh-chinh-----------------}
begin
clrscr;
write('nhap n='); readln(n);
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
min:=nn(a[1],a[2]);
for i:=3 to n do
if min>a[i] then min:=a[i];
writeln(min);
readln;
end.
Mình xin sửa lại một chút:
uses crt;
const fi='kiemtra.txt';
var f1:text;
a:array[1..100]of integer;
min,n,i:integer;
{----------------chuong-trinh-con-------------------}
function nn(x,y:integer):integer;
begin
if x<y then nn:=x
else nn:=y;
end;
{-----------------chuong-trinh-chinh-----------------}
begin
clrscr;
assign(f1,fi); reset(f1);
readln(f1,n);
for i:=1 to n do
read(f1,a[i]);
min:=nn(a[1],a[2]);
for i:=3 to n do
if min>a[i] then min:=a[i];
writeln(min);
readln;
end.
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.
#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;
}
Program HOC24;
var i,n,min: integer;
a: array[1..10000] of integer;
begin
write('Nhap so phan tu: '); readln(n);
for i:=1 to n do
begin
write('Nhap phan tu thu ',i,' :'); readln(a[i]);
end;
min:=a[1];
for i:=2 to n do
if a[i]<min then min:=a[i];
write('Phan tu nho nhat la: ',min);
readln
end.
uses crt;
var a:array[1..100]of integer;
i,n,min:integer;
begin
clrscr;
readln(n);
for i:=1 to n do readln(a[i]);
min:=a[1];
for i:=1 to n do
if min>a[i] then min:=a[i];
writeln(min);
readln;
end.
#include <bits/stdc++.h>
using namespace std;
long long a[1000],i,n,t;
int main()
{
cin>>n;
for (i=1; i<=n; i++) cin>>a[i];
t=0;
for (i=1; i<=n; i++) t+=a[i];
cout<<t<<endl;
sort(a+1,a+n+1);
for (i=1; i<=n; i++) cout<<a[i]<<" ";
return 0;
}
uses crt;
var a,b,c,nn:integer;
//chuongtrinhcon
function min(var x,y:integer):integer;
begin
if x<y then min:=x
else min:=y;
end;
//chuongtrinhchinh
begin
clrscr;
readln(a,b,c);
nn=min(a,b);
nn=min(nn,c);
writeln(nn);
readln;
end.
uses crt;
var a:array[1..100]of integer;
min,n,i:integer;
{----------------chuong-trinh-con-------------------}
function nn(x,y:integer):integer;
begin
if x<y then nn:=x
else nn:=y;
end;
{-----------------chuong-trinh-chinh-----------------}
begin
clrscr;
write('nhap n='); readln(n);
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
min:=nn(a[1],a[2]);
for i:=3 to n do
if min>a[i] then min:=a[i];
writeln(min);
readln;
end.