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 a:array[1..100]of integer;
i,n:integer;
begin
clrscr;
write('Nhap n='); readln(n);
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
writeln('Cac so chinh phuong la: ');
for i:=1 to n do
if sqrt(a[i])=trunc(sqrt(a[i])) then write(a[i]:4);
writeln;
writeln('Cac so chinh phuong chan la: ');
for i:=1 to n do
if ((sqrt(a[i])=trunc(sqrt(a[i]))) and (a[i] mod 2=0) then write(a[i]:4);
readln;
end.
for i:=1 to n do
if sqr(a[i])=sqr(trunc(sqrt(a[i]))) then
begin
write(a[i],' ');
if a[i] mod 2 =0 then write(a[i]);
writeln;
end;
2:
#include <bits/stdc++.h>
using namespace std;
long long n,i;
int main()
{
cin>>n;
for (i=1; i<=n; i++)
if (n%i==0) cout<<i<<" ";
return 0;
}
#include <bits/stdc++.h>
using namespace std;
long long a[15],i,n=15,s,t;
int main()
{
for (i=1; i<=n; i++) cin>>a[i];
s=1;
for (i=1; i<=n; i++)
if (a[i]%2==0)
{
cout<<a[i]<<" ";
s*=a[i];
}
cout<<endl;
cout<<"Tich cac so chan la: "<<s<<endl;
t=0;
for (i=1; i<=n; i++)
if (a[i]<0) t=t+a[i]*a[i];
cout<<t;
return 0;
}
#include <bits/stdc++.h>
using namespace std;
long long x,n,i,t,dem;
int main()
{
cin>>n;
dem=0;
t=0;
for (i=1; i<=n; i++)
{
cin>>x;
if (x%2==0 && x>10) t+=x;
if (x%2!=0 || x<100) dem++;
}
cout<<t<<" "<<dem;
return 0;
}
#include <bits/stdc++.h>
using namespace std;
long long n,i,a[10000];
int main()
{
cin>>n;
for (i=1; i<=n; i++)
cin>>a[i];
for (i=1; i<=n; i++) cout<<a[i]<<" ";
return 0;
}
#include <bits/stdc++.h>
using namespace std;
long long x,n,i,nn,t;
int main()
{
cin>>n;
nn=LLONG_MAX;
t=0;
for (i=1; i<=n; i++)
{
cin>>x;
t+=x;
nn=min(nn,x);
}
cout<<nn<<" "<<t;
return 0;
}
Bài 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 5=0 then t:=t+a[i];
writeln('Tong cac so chia het cho 5 la: ',t);
readln;
end.
Bài 2:
uses crt;
var st:string;
d,i:integer;
begin
clrscr;
write('Nhap xau:'); readln(st);
d:=length(st);
for i:=1 to d do
if st[i]=#32 then delete(st,i,1);
writeln(st);
readln;
end.
uses crt;
var a:array[1..100]of integer;
i,n,dem:integer;
begin
clrscr;
readln(n);
for i:=1 to n do readln(a[i]);
dem:=0;
for i:=1 to n do
if (trunc(sqrt(a[i]))=sqrt(a[i]) then dem:=dem+1;
writeln(dem);
readln;
end.
uses crt;
var a:array[1..100]of integer;
n,i,t,nn,kt:integer;
begin
clrscr;
readln(n);
for i:=1 to n do readln(a[i]);
t:=1;
for i:=1 to n do
if a[i] mod 3=0 then t:=t*a[i];
writeln(t);
kt:=0;
nn:=32567;
for i:=1 to n do
if a[i] mod 3=0 then
begin
if nn>a[i] then nn:=a[i];
kt:=1;
end;
if kt=0 then writeln('Khong co so chia het cho 3')
else writeln('So nho nhat chia het cho 3 la: ',nn);
for i:=1 to n do
if nn=a[i] then write(i:4);
writeln;
for i:=n downto 1 do
write(a[i]:4);
readln;
end.
uses crt;
var i:integer;
begin
clrscr;
for i:=0 to 9999 do
if trunc(sqrt(i))=sqrt(i) then write(i:4);
readln;
end.
theo C++ hay là free pascal vậy anh?