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;
var i,n: integer;
begin clrscr;
readln(n);
for i:=1 to n do if(i mod 2<>0) then writeln(i);
readln;
end.
#include <bits/stdc++.h>
using namespace std;
long long a[10],n=10,i,ln;
int main()
{
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<<endl;
if (ln%2==0) cout<<"Phai";
else cout<<"Khong phai";
return 0;
}
program bt;
uses crt;
var i, max : integer;
a : array[1..10] of integer;
begin
clrscr;
for i:=1 to 10 do begin
write('Nhap so thu ',i,': '); readln(a[i]);
end;
max := 0;
for i:=1 to 10 do if a[i] > max then max := a[i];
if (max mod 2 = 0) then write(max,' la so lon nhat va la so chan')
else write(max,' la so lon nhat va la so le');
readln
end.
program TongSoChanTrongDay;
var
n, i, tong: integer;
a: array[1..100] of integer;
begin
tong := 0;
write('Nhap so phan tu cua day: ');
readln(n);
for i := 1 to n do
begin
write('Nhap phan tu thu ', i, ': ');
readln(a[i]);
if a[i] mod 2 = 0 then
tong := tong + a[i];
end;
writeln('Tong cac phan tu chan trong day la: ', tong);
readln;
end.
Program HOC24;
var min,max,i,n: integer;
a: array[1..1000] of integer;
begin
write('Nhap N: '); readln(n);
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
max:=a[1]; min:=a[1];
for i:=2 to n do
begin
if a[i]> max then max:=a[i];
if a[i]<min then min:=a[i];
end;
writeln('Gia tri lon nhat la: ',max);
write('Gia tri nho nhat la: ',min);
readln
end.
program bai_toan;
var
N, i, sum: integer;
begin
write('Nhap so N: ');
readln(N);
write('Cac uoc cua ', N, ' khong ke ', N, ' la: ');
for i := 1 to N - 1 do
if N mod i = 0 then
write(i, ' ');
writeln;
sum := 0;
for i := 1 to N - 1 do
begin
if N mod i = 0 then sum := sum + i;
end;
if sum = N then writeln(N, ' la so hoan hao')
else writeln(N, ' khong phai la so hoan hao');
writeln;
writeln('Tat ca so hoan hao trong pham vi 1 -> ', N, ' la:');
for i := 1 to N do
begin
sum := 0;
for j := 1 to i - 1 do
begin
if i mod j = 0 then sum := sum + j;
end;
if sum = i then writeln(i);
end;
readln;
end.
#include <bits/stdc++.h>
using namespace std;
int main()
{
int n,A[100],dem,t;
cin>>n;
for (int i=1; i<=n; i++)
cin>>A[i];
dem=0; t=0;
for (int i=1; i<=n; i++)
if (A[i]%2==0) dem++;
else t+=A[i];
cout<<dem<<endl;
cout<<t;
return 0;
}
Làm như z có đg ko
Uses crt;
Var n,i: integer;
A: Array[1..1000] of integer;
Begin
clrscr;
Repeat
Write('Nhap n: '); Readln(n);
Until (n<103) and (n>0);
a)
For i:=1 to n do
begin
Write('Nhap phan tu A[',i,']= ');
Readln(A[i]);
end;
b)
Write('Cac phan tu chan co trong mang: ');
For i:=1 to n do
If A[i] mod 2=0 then write(A[i],' ');
writeln;
c)
Write('Cac phan tu le co trong mang: ');
For i:=1 to n do
If A[i] mod 2=1 then write(A[i],' ');
Readln
End.
Uses crt;
var i,n: longint;
a: array[1..103] of longint;
begin clrscr;
readln(n);
for i:=1 to n do read(a[i]); readln;
for i:=1 to n do if(a[i] mod 2=0) then write(a[i],' ');
for i:=1 to n do if(a[i] mod 2<>0) then write(a[i],' ');
readln;
end.
program Hien_thi;
uses crt;
var n,i:longint;
begin
clrscr;
writeln('nhap so tu nhien n'); readln(n);
for i:=1 to n do
if n mod i=0 then writeln('Uoc cua n la',n/i:0:0);
readln
end.
Program tim_uoc;
Uses crt;
Vả i,N:integer;
Begin
Clrscr;
Writeln('Nhap gia tri N:');Readln(N);
For i:=1 to N do
If N mod i =0 then writeln(i,'la uoc cua N);
Readln
End.