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.
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.
#include <iostream>
#include <vector>
int main() {
std::vector<int> sequence = {10, 3, 6, 10, 6, 12, 10, 9, 18, 19, 21, 15, 19, 24, 21, 19, 27, 27, 28, 30};
int N;
std::cout << "Nhap so tu nhien N: ";
std::cin >> N;
int termN = sequence[N - 1];
int sum = 0;
for (int i = 0; i < N; i++) {
sum += sequence[i];
}
std::cout << "So hang thu " << N << " cua day so la: " << termN << std::endl;
std::cout << "Tong cua " << N << " so hang dau tien cua day so la: " << sum << std::endl;
return 0;
}
#include <bits/stdc++.h>
using namespace std;
long long n,i,x,nn;
int main()
{
cin>>n;
nn=LLONG_MAX;
for (i=1; i<=n; i++)
{
cin>>x;
nn=min(nn,x);
}
cout<<nn;
return 0;
}
Bài 1:
Program HOC24;
var a: array[1..1000] of integer;
i,n,d: integer;
begin
write('Nhap so phan tu: '); 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]<0) and (a[i] mod 2=0) then d:=d+1;
write('Co ',d,' so nguyen am chan trong day so');
readln
end.
Bài 2:
Program HOC24;
var a: array[1..1000] of integer;
i,n: integer;
t: longint;
begin
write('Nhap so phan tu: '); readln(n);
for i:=1 to n do
begin
write('Nhap so thu ',i,': '); readln(a[i]);
end;
t:=0;
for i:=1 to n do if a[i] mod 5=0 then t:=t+a[i];
write(Tong la: ',t);
readln
end.