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='dl.txt';
var f1:text;
a,b,c,kq:integer;
{---------------------------chuong-trinh-con-doc-tep------------------------}
procedure docfile;
begin
assign(f1,fi); reset(f1);
readln(f1,a,b,c);
end;
{---------------------------chuong-trinh-con-tim-gtln-----------------------}
function gtln(n,m:integer):integer;
begin
gtln:=n;
if gtln<m then gtln:=m;
end;
{---------------------------chuong-trinh-chinh------------------------------}
begin
clrscr;
docfile;
kq:=gtln(a,b);
if kq<c then kq:=c;
writeln(kq);
close(f1);
readln;
end.
uses crt;
var a,b:integer;
{-------------chuong-trinh-con-tinh-tong---------------------}
function tong(x,y:integer):integer;
begin
tong:=x+y;
end;
{-------------chuong-trinh-con-tinh-tich------------------}
function tich(x,y:integer):integer;
begin
tich:=x*y;
end;
{-----------------chuong-trinh-con-so-lon------------------}
function solon(x,y:integer):integer;
begin
if x>y then solon:=x
else solon:=y;
end;
{-----------------chuong-trinh-con-so-be------------------}
function sobe(x,y:integer):integer;
begin
if x<y then sobe:=x
else sobe:=y;
end;
{--------------------chuong-trinh-chinh-----------------}
begin
clrscr;
write('Nhap a='); readln(a);
write('Nhap b='); readln(b);
writeln('Tong la: ',tong(a,b));
writeln('Tich la: ',tich(a,b));
writeln('So lon la: ',solon(a,b));
writeln('So be la: ',sobe(a,b));
readln;
end.
#include <bits/stdc++.h>
using namespace std;
long long b[20],i,n;
int main()
{
cin>>n;
for (i=1; i<=n; i++) cin>>b[i];
for (i=1; i<=n; i++)
{
if ((b[i]%2!=0) or (i%2==0)) cout<<b[i]<<" ";
}
return 0;
}
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.