Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AN ASSIGNMENT. PLS HELP ME OUT #1826

Open
Genesi2006 opened this issue Jun 30, 2024 · 1 comment
Open

AN ASSIGNMENT. PLS HELP ME OUT #1826

Genesi2006 opened this issue Jun 30, 2024 · 1 comment

Comments

@Genesi2006
Copy link

Write a psuedocode to accept 10 numbers from a user and store it in an array and check if the first element of the array is divisible by the last element of the array. if true, display the first element of the array 10 times. if false, display the last element of the array 10 times. Divide the program into two modules

@HSanny
Copy link

HSanny commented Jul 1, 2024

updated to modify writing format

1. Main()
2.     Initialize ARRAY as empty
3.     Set COUNTER to 0
4.     While COUNTER < 10
5.         Read NUMBER
6.         Append NUMBER to ARRAY
7.         Increment COUNTER
8.     Call CheckDivisibility(ARRAY)

9. CheckDivisibility(ARRAY)
10.    FIRST_ELEMENT = ARRAY[0]
11.    LAST_ELEMENT = ARRAY[-1]
12.    If FIRST_ELEMENT % LAST_ELEMENT == 0
13.        Repeat 10 times
14.            Print FIRST_ELEMENT
15.    Else
16.        Repeat 10 times
17.            Print LAST_ELEMENT

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants