Computer Science, asked by poulami11, 1 year ago

draw a flow chart and write an algorithm for a program that multiplies all two digit odd numbers

Answers

Answered by singhalseema03p9uwqn
6
The "two digit odd numbers" are the sequence (11, 13, 15, ..., 95, 97, 99). That's an arithmetic sequence (aka "arithmetic progression") and when the terms are all integers, the usual way to generate the elements (in order) is to use a for loop:

for i := 11 to 99 step 2 do
.... for j = 11 to 99 step 2 do
.... .... [multiply i times j]
.... end for
end for

That generates all 45^2 = 2025 (i,j) pairs; (11,11), (11.13), ...(11,19), (13,11), (13,13), ....(97,99), (99,99)

If you're only interested in unique pairs, you can easily restrict that to the case where i<=j with just a small change to the inner for loop:

for i := 11 to 99 step 2 do
.... for j = i to 99 step 2 do
.... .... [multiply i times j]
.... end for
end for

That will generate the pairs (11,11), (11,13), ... (11,19), (13, 13), (13,15), ... (13,19), (15,15), ....
Similar questions