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.
Program Xoa_mang;
uses crt;
var m:array[1..100] of integer;
n,i,k:byte;
begin
Write(‘So phan tu cua day: ‘);readln(n);
for i:=1 to n do
Begin
write(‘M[‘,i,’]=’);
readln(M[i]);
end;
write(‘Nhap phan tu can xoa: ‘);readln(k);
for i:=k to n-1 do m[i]:=m[i+1];
for i:=1 to n-1 do write(m[i],’ ‘);
readln
end.
1)
Var array:[1..1000] of integer;
i,n,t:integer;
Begin
Write('n = ');readln(n);
For i:=1 to n do
Begin
Write('Nhap so thu ',i,' = ');readln(a[i]);
End;
For i:=1 to n do
If a[i] > a[i+1] then
Begin
t:=a[i];
a[i]:=a[i+1];
a[i+1]:=t;
End;
Write('Sap xep tang dan ');
For i:=1 to n do write(a[i]:8);
Readln
End.
2)
Var array:[1..1000] of integer;
i,n,t:integer;
Begin
Write('n = ');readln(n);
For i:=1 to n do
Begin
Write('Nhap so thu ',i,' = ');readln(a[i]);
End;
For i:=1 to n do
If a[i] < a[i+1] then
Begin
t:=a[i];
a[i]:=a[i+1];
a[i+1]:=t;
End;
Write('Sap xep giam dan ');
For i:=1 to n do write(a[i]:8);
Readln
End.
Câu 1:
uses crt;
var a:array[1..100]of integer;
i,n,t:integer;
begin
clrscr;
write('Nhap n='); readln(n);
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
t:=0;
for i:=1 to n do
t:=t+a[i];
writeln(t);
readln;
end.
Câu 2:
uses crt;
var a:array[1..100]of integer;
i,n,x,dem,kt:integer;
begin
clrscr;
write('Nhap n='); readln(n);
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
write('Nhap x='); readln(x);
kt:=0;
dem:=0;
for i:=1 to n do
if a[i]=x then
begin
kt:=1;
write(i:4);
inc(dem);
end;
if kt=0 then writeln('Khong co ',x,' trong day');
writeln(x,' xuat hien ',dem,' lan trong day');
readln;
end.
#include <bits/stdc++.h>
using namespace std;
long long a[1000],i,n,ln;
int main()
{
cin>>n;
for (i=1; i<=n; i++) cin>>a[i];
ln=a[1];
for (i=1; i<=n; i++) ln=max(ln,a[i]);
cout<<ln;
return 0;
}
Var a:array[1..200] of integer;
i,n,min:integer;
begin
write('Nhap so luong phan tu n = ');readln(n);
for i:=1 to n do
begin
write('Nhap phan tu thu ',i,' = ');readln(a[i]);
min:=a[1];
if a[i] < min then min:=a[i];
end;
write('So nho nhat la ',min);
readln;
end.
Bài này mới đúng nhé!
Var a:array[1..200] of integer;
i,n,min:integer;
begin
write('Nhap so luong phan tu n = ');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('So nho nhat la ',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.
Program Xoa_mang;
uses crt;
var m:array[1..100] of integer;
n,i,k:byte;
begin
Write(‘So phan tu cua day: ‘);readln(n);
for i:=1 to n do
Begin
write(‘M[‘,i,’]=’);
readln(M[i]);
end;
write(‘Nhap phan tu can xoa: ‘);readln(k);
for i:=k to n-1 do m[i]:=m[i+1];
for i:=1 to n-1 do write(m[i],’ ‘);
readln
end.