Download as pdf or txt
Download as pdf or txt
You are on page 1of 4

Start

What task would you like to run?

read "answer"

Label

"answer"= M|m Run "Task 1"


MENU Flowchart

"answer" = S|s Run "Task 2"

"answer" = P|p Run "Task 3"

"answer" = Q|q End

"Invalid Option"
Start

Task 1
enter positive
"number" Find the even multiples of any number – the user should specify the
multiples of which number they want to print and how many of them (for
example if the user choses the number 7 and would like to print four even
multiples, the program should print 14, 28, 42, 56 )
enter the number of
multiples to display "multiples"

counter=1
even=2

WHILE

counter<=multiples

product=number*even counter=counter+1
even=even+2

IF

counter<=multiples print $product

End of While/IF

End
TASK 2 Start

Find the terms of any linear sequence


given by the rule Un = an + b, where a
and b are Input a (integer)
integers specified by the user and n is (integer)
a positive integer, and print them in yes
increasing order (for
example if the user inputs a=3, b=‐4,
the first few terms that should be Input b (integer)
printed are ‐1, 2, 5, 8,
11…). The user also will specify how
many terms the program should print.
The user should be
allowed to choose another sequence Input n (positive
and for the number of terms chosen integer)
the program should
calculate and print their sum.

Set sum = 0

Input new No
End
sequence?
counter = 1

Output sum No

counter <= n

yes

Set product = a* counter

Set product = product + b

Output product

Set sum = sum + product Let counter ++


Start Task 3 Diagram
Find the numbers that can be expressed as the product of two nonnegative integers in
succession and print them in increasing order. (For example, 30 is such a number as it can be
written as the product of 5 and 6 (30=5x6), which are two numbers in succession.)
The user should specify a maximum value and the program should print all said numbers
numone=0
smaller than or equal to that value. The program should keep a count of how many numbers were
numtwo=1
printed and should output that count, as well as the numbers.
product=0
sum=0

"Enter max value"


maxv

For/While

product<=maxv

product=(numone*numtwo)

IF

print $product
sum=(sum+product)
product<=maxv Then
numone=numone+1
numtwo=numtwo+1

print $sum

End

You might also like