Program Mang;
Uses crt;
Var A: array[1..100000] of longint;
n, cnt, sum, i: longint;
Function is_Prime(a: longint): boolean;
Var i: longint;
Begin
If a < 2 then exit(false);
For i:=2 to trunc(sqrt(a)) do
If a mod i = 0 then exit(false);
exit(true);
End;
Function isHH(a: longint): boolean;
Var ans, i: longint;
Begin
ans := 0;
For i:=1 to a div 2 do
If a mod i = 0 then ans := ans + i;
If ans = a then exit(true);
exit(false);
End;
Begin
Clrscr;
Write('Nhap n: '); Readln(n);
cnt := 0;
sum := 0;
For i:=1 to n do
Begin
Write('A[',i,'] = ');
Readln(A[i]);
If is_Prime(A[i]) then inc(cnt);
If isHH(A[i]) then sum := sum + A[i];
End;
Writeln('Co ',cnt,' so nguyen to');
Write('Tong cac so hoan hao la ',sum);
Readln
End.
uses crt;
var n,i,count,res:longint;
a:array[1..100]of longint;
function isPrimeNumber(n:longint):boolean;
var i:longint;
begin
if n<2 then exit(false);
for i:=2 to trunc(sqrt(n)) do
if n mod i=0 then exit(false);
exit(true);
end;
function isPerfectNumber(n:longint):boolean;
var i,res:longint;
begin
res:=0;
for i:=1 to n div 2 do
if n mod i=0 then inc(res,i);
if res=n then exit(true) else exit(false);
end;
begin
clrscr;
readln(n);
for i:=1 to n do
begin
readln(a[i]);
if isPrimeNumber(a[i]) then inc(count);
if isPerfectNumber(a[i]) then inc(res,a[i]);
end;
writeln(count);
writeln(res);
readln;
end.
//Harry Le
Tin học, tiếng Anh: informatics, tiếng Pháp: informatique, là một ngành khoa học chuyên nghiên cứu quá trình tự động hóa việc tổ chức, lưu trữ, xử lý và truyền dẫn thông tin của một hệ thống máy tính cụ thể hoặc trừu tượng (ảo). Với cách hiểu hiện nay, tin học bao hàm tất cả các nghiên cứu và kỹ thuật có liên quan đến việc mô phỏng, biến đổi và tái tạo thông tin.
Nguồn : Wikipedia - Bách khoa toàn thưLớp 11 - Năm thứ hai ở cấp trung học phổ thông, gần đến năm cuối cấp nên học tập là nhiệm vụ quan trọng nhất. Nghe nhiều đến định hướng sau này rồi học đại học. Ôi nhiều lúc thật là sợ, hoang mang nhưng các em hãy tự tin và tìm dần điều mà mình muốn là trong tương lai nhé!
Nguồn : ADMIN :))Xem thêm tại https://loigiaisgk.com/cau-hoi or https://giaibtsgk.com/cau-hoi
Copyright © 2021 HOCTAPSGK