Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Mobile Usability

Authors: Jakob Nielsen, Raluca Budiu

1st Edition

0133122131, 9780133122138

More Books

Students also viewed these Programming questions

Question

Why do bars offer free peanuts?

Answered: 1 week ago