Question
In perl please Exercise 1: One of the traditional exercises to show loops is finding prime numbers. Write a program that displays all the primes
In perl please
Exercise 1:
One of the traditional exercises to show loops is finding prime numbers. Write a program that displays all the primes between 2 and 1,000 (the last is 997). Show each prime as it is found. Also show how many primes you found at the end of the program.
Exercise 2:
Modify the prime number program you wrote earlier to list primes between 2 and 1000. List the primes in a column, stacked one on top of each other so the column of digits are correct, like this: 002 003 005 007 011
.
.
.
111
.
.
.
997
------You may turn in 1 & 2 as one exercise.------
Exercise 3:
Prompt the user for a long string, followed by a short string to search for. Use both index and rindex to locate the short string inside the longer one and compare the results.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started