Fill in the blanks of the pseudocode that will accept a value for a positive integer N. Then, be able to determine which values from 1 to N are perfect squares and which are perfect cubes.  Note: For 3 and 4, we want a condition that says “anything higher than this (3) AND the answer in (4) will be unnecessary to check/iterate (we want the BEST answer)

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question
100%

Fill in the blanks of the pseudocode that will accept a value for a positive integer N. Then, be able to determine which values from 1 to N are perfect squares and which are perfect cubes. 

Note: For 3 and 4, we want a condition that says “anything higher than this (3) AND the answer in (4) will be unnecessary to check/iterate (we want the BEST answer)

1 get input n
2 set a variable num = 1
3 if num <= _(1)_, goto step 4, otherwise go to step 11
4 set a variable factor = 1
5 if factor <= num goto step 6, otherwise goto _(2)_
6 if factor*factor == num, print “num is a perfect square"
7 if factor*factor*factor == num, print "num is a perfect cube"
8 if -(3)_ and _(4)_, goto step 10
9 increment factor: factor = factor+1, goto step 5
10 increment num: num = num+1, goto _(5)_
11 terminate program
Transcribed Image Text:1 get input n 2 set a variable num = 1 3 if num <= _(1)_, goto step 4, otherwise go to step 11 4 set a variable factor = 1 5 if factor <= num goto step 6, otherwise goto _(2)_ 6 if factor*factor == num, print “num is a perfect square" 7 if factor*factor*factor == num, print "num is a perfect cube" 8 if -(3)_ and _(4)_, goto step 10 9 increment factor: factor = factor+1, goto step 5 10 increment num: num = num+1, goto _(5)_ 11 terminate program
N = 100
1
is a perfect square
1 is a perfect
4 is a perfect square
8
cube
is a perfect cube
is a perfect square
9
16 is a perfect square
25 is a perfect square
27 is a perfect cube
36
is a perfect square
49 is a perfect square
64
is a perfect cube
64 is a perfect square
81
is a perfect square
100
is a perfect square
Transcribed Image Text:N = 100 1 is a perfect square 1 is a perfect 4 is a perfect square 8 cube is a perfect cube is a perfect square 9 16 is a perfect square 25 is a perfect square 27 is a perfect cube 36 is a perfect square 49 is a perfect square 64 is a perfect cube 64 is a perfect square 81 is a perfect square 100 is a perfect square
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 2 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY