with reference to images attached, draw a flow chart(visual) for the following question based on javascript computational thinking Given a 1D array of 100 numbers, find all pairs that are prime to each other (i.e., their GCD is 1).
with reference to images attached, draw a flow chart(visual) for the following question based on javascript computational thinking Given a 1D array of 100 numbers, find all pairs that are prime to each other (i.e., their GCD is 1).
C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter8: Arrays And Strings
Section: Chapter Questions
Problem 24PE
Related questions
Question
with reference to images attached, draw a flow chart(visual) for the following question based on javascript computational thinking
Given a 1D array of 100 numbers, find all pairs that are prime to each other (i.e., their GCD is 1).

Transcribed Image Text:Advanced Example 10
Devise a program to receive
a positive number, and print
all prime numbers less than
or equal to that number
We are going to reuse our solution to
Advanced Example 4 (to check if a
number is prime or not). we need to
modify it a bit to return a True or False
answer though.
York University EECS 1012F2023
...continued
This is called sub-algorithm
A sub-algorithm is called from
other algorithms
We called the prime sub-
algorithm from inside our AE10
When tracing an algorithm, we
normally treat sub-algorithms
as a black box (and we assume
they are correct)
precondition: num = N
postcondition: output all prime
numbers ≤ num
Exercise: trace advanced
example 10, for when input is 8
York University EECS 1012 F2023
14-2
start
num
1<--1+1
prime(/) = true
T
end
is num
Comp. Thinking (pt 3: Verification) 23
precondition: num>1 € N
postcondition: returns true if
num is prime, otherwise
returns false.
prime(num)
start
flag-true
d←2
flag true and
ds num/2
num mod d=0
flag-false
d+d+1
F
ret flag
Comp. Thinking (pt 3: Verification) 24
F
![Advanced Example 5
start
sum 0
i ← 1
i←i + 1
i≤ 100
T
sumsum + a[i]
"sum = ", sum
end
Devise a program to
output sum of values
stored in an array of
100 elements
precondition: a; E R, 1 ≤ i ≤ 100
postcondition: a₁is outputted
100](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F1a310ed2-3377-4dab-b1a9-29fbcd4a5ef4%2Ff42b7eee-3e5f-4650-b312-d5874afcc62b%2Fgtl66ru_processed.png&w=3840&q=75)
Transcribed Image Text:Advanced Example 5
start
sum 0
i ← 1
i←i + 1
i≤ 100
T
sumsum + a[i]
"sum = ", sum
end
Devise a program to
output sum of values
stored in an array of
100 elements
precondition: a; E R, 1 ≤ i ≤ 100
postcondition: a₁is outputted
100
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 3 steps with 2 images

Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Recommended textbooks for you

C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage

Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,

C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage

Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,

EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT

C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr

Systems Architecture
Computer Science
ISBN:
9781305080195
Author:
Stephen D. Burd
Publisher:
Cengage Learning