Quảng cáo
2 câu trả lời 659
var s:int64;tb:real;n,i:int64;
function nt(n:int64):boolean;
var i:longint;
begin
if n<2 then exit(false) else
if n<4 then exit(true);
if (n mod 2=0) or (n mod 3=0) then exit(false);
for i:=1 to (trunc(sqrt(n))+1) div 6 do
if (n mod (6*i+1)=0) or(n mod (6*i-1)=0) then exit(false);
exit(true):
end;
begin
repeat
read(n);
if n mod 2=0 then s:=s+n else begin tb:=tb+n;inc(i); end;
until nt(n);
writeln(s);
write(tb/i:0:2);
readln;
end.
Program BTT;
Uses crt;
Var n, d: longint;
Begin
Clrscr;
d:=0;
Repeat
Write('Nhap mot so bat ki: '); Readln(n);
If n mod 2 = 0 then inc(d);
Until n=0;
Write('Co ',d,' so la so chan');
Readln
End.
Quảng cáo
Bạn cần hỏi gì?
Câu hỏi hot cùng chủ đề
-
Hỏi từ APP VIETJACK45477
-
Hỏi từ APP VIETJACK28343
