Question: (Display non-prime numbers) Write a program that displays all the non-prime numbers less than 100 in decreasing order. Use the StackOfIntegers class to store the

(Display non-prime numbers) Write a program that displays all the non-prime numbers less than 100 in decreasing order. Use the StackOfIntegers class to store the non-prime numbers (e.g., 4, 6, 8, . . .) and retrieve and display them in reverse order. This class can be found either with the lecture notes or with the lab exercise files (both the implementation and the definition are given). (A positive integer which is only divisible by 1 and itself is known as a prime number.) An example of the output:

(Display non-prime numbers) Write a program that displays all the non-prime numbers

Non-prime numbers from 1-100 in reverse order are: 100 99 98 96 95 94 93 92 91 90 88 87 86 85 84 82 81 80 78 77 76 75 74 72 70 69 68 66 65 64 63 62 60 58 57 56 55 54 52 51 50 49 48 46 45 44 42 40 39 38 36 35 34 33 32 30 28 27 26 25 24 22 21 20 18 16 15 14 12 10 9 8 6 4 Press any key to continue

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!