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.
Câu 1:
uses crt;
var a:array[1..5]of integer;
max,i:integer;
begin
clrscr;
for i:=1 to 5 do
begin
write('A[',i,']='); readln(a[i]);
end;
max:=a[1];
for i:=1 to 5 do
if max<a[i] then max:=a[i];
writeln(max);
readln;
end.
Câu 2:
uses crt;
var a:array[1..6]of integer;
min,i:integer;
begin
clrscr;
for i:=1 to 6 do
begin
write('A[',i,']='); readln(a[i]);
end;
min:=a[1];
for i:=1 to 6 do
if min>a[i] then min:=a[i];
writeln(min);
readln;
end.
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.
Câu 1:
uses crt;
var a:array[1..200]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
if a[i] mod 2=0 then t:=t+a[i];
writeln(t);
readln;
end.
Program HOC24;
var a: array[1..32000] of integer;
i,n: integer;
begin
write('Nhap so phan tu cua mang: '); readln(n);
for i:=1 to n do
begin
write('a[',i,']='); readln(a[i]);
end;
write('Mang vua nhap: ');
for i:=1 to n do write(a[i],' ');
writeln;
write('Cac so chan trong mang la: ');
for i:=1 to n do if a[i] mod 2=0 then write(a[i],' ');
writeln;
write('Cac so chinh phuong trong mang la: ');
for i:=1 to n do if if sqr(trunc(sqrt(a[i])))=a[i] then write(a[i],' ');
readln
end.
#include <bits/stdc++.h>
using namespace std;
long long a[100],i,n;
int main()
{
cin>>n;
for (i=1; i<=n; i++) cin>>a[i];
for (i=1; i<=n; i++)
if (a[i]>0) cout<<a[i]<<" ";
return 0;
}
Bài 1
Var a:array:[1..99] of integer;
i,n:integer;
s:longint;
Begin
Repeat
Write('n = ');readln(n);
Until (n > 0) and (n < 100);
For i:=1 to n do
Begin
Write('Nhap diem thu ',i,' = ');readln(a[i]);
if a[i] mod 2 = 0 then s:=s+a[i];
End;
Write('Cac so vua nhap la: ');
For i:=1 to n do
Write(a[i]:8);
writeln;
write('Tong cac so chan la ',s);
Readln
End.
Bài 2
Var a:array:[1..99] of integer;
i,n:integer;
s:longint;
Begin
Repeat
Write('n = ');readln(n);
Until (n > 0) and (n < 100);
For i:=1 to n do
Begin
Write('Nhap diem thu ',i,' = ');readln(a[i]);
if a[i] mod 2 <> 0 then s:=s+a[i];
End;
Write('Cac so vua nhap la: ');
For i:=1 to n do
Write(a[i]:8);
writeln;
write('Tong cac so le la ',s);
Readln
End.
#include <bits/stdc++.h>
using namespace std;
long long a[1000],n,i,dem1,dem2;
int main()
{
cin>>n;
for (i=1; i<=n; i++) cin>>a[i];
for (i=1; i<=n; i++) cout<<a[i]<<" ";
cout<<endl;
dem1=0;
dem2=0;
for (i=1; i<=n; i++)
{
if (a[i]%2==0) dem1++;
else dem2++;
}
cout<<dem1<<" "<<dem2;
return 0;
}
uses crt;
var a:array[1..100]of integer;
i,n,j:integer;
kt:boolean;
begin
clrscr;
readln(n);
for i:=1 to n do readln(a[i]);
for i:=1 to n do
if trunc(sqrt(a[i]))=sqrt(a[i]) then write(a[i]:4);
writeln;
for i:=1 to n do
if a[i]>1 then
begin
kt:=true;
for j:=2 to trunc(sqrt(a[i])) do
if a[i] mod j=0 then kt:=false;
if kt=true then write(a[i]:4);
end;
writeln;
readln;
end.