var N, i, number: integer; sum, count: integer; average: real;
begin sum := 0; count := 0;
write('Enter the number of values: '); readln(N);
for i := 1 to N do begin write('Enter number ', i, ': '); readln(number);
if (number mod 3 = 0) and (number mod 5 = 0) then begin sum := sum + number; count := count + 1; end;
end;
if count > 0 then begin average := sum / count; writeln('Average of numbers divisible by both 3 and 5: ', average:0:2); end else writeln('No numbers divisible by both 3 and 5 were entered.'); end.
program AverageOfMultiples;
var
N, i, number: integer;
sum, count: integer;
average: real;
begin
sum := 0;
count := 0;
write('Enter the number of values: ');
readln(N);
for i := 1 to N do
if (number mod 3 = 0) and (number mod 5 = 0) thenbegin
write('Enter number ', i, ': ');
readln(number);
begin
sum := sum + number;
count := count + 1;
end;
end;
if count > 0 then
begin
average := sum / count;
writeln('Average of numbers divisible by both 3 and 5: ', average:0:2);
end
else
writeln('No numbers divisible by both 3 and 5 were entered.');
end.