Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a program that uses a loop to print the integers 1 to 100, one number on each line. When a number is divisible by

Write a program that uses a loop to print the integers 1 to 100, one number on each line. When a number is divisible by 3, print "Blue" on the same line, and separate them by a space. When a number is divisible by 5, print "Berry"; and when a number is divisible by 15, print "Blueberry".

Note that a number divisible by 15 will also be divisible by 3 and 5. In this case, only "Blueberry" should be printed.

Provide an input form that accepts a number n that determines how many times the loop should iterate (100 in the example above). The form should also allow the end-user to enter any two words to display and concatenate (e.g., "Blue" and "Berry" above).

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

Modern Database Management

Authors: Jeffrey A. Hoffer Fred R. McFadden

9th Edition

B01JXPZ7AK, 9780805360479

More Books

Students also viewed these Databases questions

Question

1 what does yellow colour on the map represent?

Answered: 1 week ago