begin
var sum := 0;
var count := 0;
foreach var x in Range(100, 999) do
var s := x.ToString;
var sum2 := 0;
for var i := 1 to s.Length do
sum2 += s[i].ToDigit;
if sum2.isOdd then
sum += x;
count += 1
end
end;
sum.Println;
count.Println
end.
Copyright © 2024 SCHOLAR.TIPS - All rights reserved.
Answers & Comments
begin
var sum := 0;
var count := 0;
foreach var x in Range(100, 999) do
begin
var s := x.ToString;
var sum2 := 0;
for var i := 1 to s.Length do
sum2 += s[i].ToDigit;
if sum2.isOdd then
begin
sum += x;
count += 1
end
end;
sum.Println;
count.Println
end.