1 var
2 a: array[1..10] of integer;
3 i,sum:integer;
4 begin
5 sum:=0;
6 write('Enter elementi: ');
7 for i:=1 to 10 do
8 read(a[i]);
9 writeln;
10 for i:=1 to 10 do
11 begin
12 write(a[i],' ');
13 sum:=sum+a[i];
14 end;
15 writeln;
16 writeln(sum);
17 readln;
18 end.
var
numbers: array[1..10] of integer;
index, sum: integer;
begin
writeln('Enter the array: ');
for index := 1 to 10 do
readln(numbers[index]);
sum := 0;
if numbers[index] <= 10 then
sum := sum + numbers[index];
writeln(sum);
end.
Copyright © 2024 SCHOLAR.TIPS - All rights reserved.
Answers & Comments
1 var
2 a: array[1..10] of integer;
3 i,sum:integer;
4 begin
5 sum:=0;
6 write('Enter elementi: ');
7 for i:=1 to 10 do
8 read(a[i]);
9 writeln;
10 for i:=1 to 10 do
11 begin
12 write(a[i],' ');
13 sum:=sum+a[i];
14 end;
15 writeln;
16 writeln(sum);
17 readln;
18 end.
Verified answer
var
numbers: array[1..10] of integer;
index, sum: integer;
begin
writeln('Enter the array: ');
for index := 1 to 10 do
readln(numbers[index]);
sum := 0;
for index := 1 to 10 do
if numbers[index] <= 10 then
sum := sum + numbers[index];
writeln(sum);
end.