Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Software Requirements Prompt the user for the number of times to print a message. Read the number of times as an integer into variable n

Software Requirements
Prompt the user for the number of times to print a message.
Read the number of times as an integer into variable n.
Define an int variable named i which is initialized to 1.
Write a loop which executes n times by varying the value of i from 1,2
a. Each time through the loop, print a line of output.
b. At the beginning of the output line, print the current value of i.
c. Following the value of i, print a space, followed by the string "I love
d. End each output line with a newline.
Following the last output line, print the message Printed this message
End each output line with a newline.
Example 1
How many times should I print? 3
1 I love Computer Science!!
2 I love Computer Science!!
3 I love Computer Science!!
Printed this message 3 times.
Example 2
How many times should I print? 6
1 I love Computer Science!!
21 love Computer Science!!
3 I love Computer Science!!
4 I love Computer Science!!
5 I love Computer Science!!
61 love Computer Science!!
Printed this message 6 times.
image text in transcribed

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

Database Design And SQL For DB2

Authors: James Cooper

1st Edition

1583473572, 978-1583473573

More Books

Students also viewed these Databases questions

Question

Find the centroid of the region shown. 13. 14. (3.2) 3 -2 2.

Answered: 1 week ago