mailmesanjayfashions mailmesanjayfashions
  • 23-07-2021
  • Computers and Technology
contestada

if a= ‘ Stay home, Stay safe’ , print its value
a. 3 times in the same line
( 2 x 1 = 2)
b. 2 times in different lines using one print statement

Respuesta :

SkyAutumnLeaf SkyAutumnLeaf
  • 23-07-2021

Answer:

Since the language isn’t stated, I’ll give answers in the two most-used (?) languages: Java and Python.

a) To print a’s value 3 times in the same line, in Java we would do:

System.out.print(a+a+a);

In Python, we would write:

print(a*3)

b) 2 times in different lines using one print statement

In Java, we would write

System.out.println(a+”\n”+a+”\n”+a);

In Python we would write:

print(a,a,a,sep=’/n’)

Hope this helps!

Answer Link

Otras preguntas

How long does it take light to reach us from the sun, 1. 50 ×108km away?.
Analyze the image below and answer the question that follows. A supercontinent called Pangaea. Image by Kieff Use your knowledge of plate tectonics to explain w
what are the symptoms of people living with cancer?​
What is the solution to the equation 6x + 2(x − 3) = 4x + x − 18? (1 point) 4 2 −2 −4​
1. Mrs. Galicia is building a chicken farm in 2021 with an initial population of 3750 chickens. The farm grows at a rate of 2.15% annually. (a) Use the exponent
help me pleaseeeeeeee
What is the value of f
For economics!!!! Investing contributes to economic growth in which of the following ways? (1 point) A. Investors diversify their portfolios to minimize risk in
Round 1.26 to the nearest tenthヽ( ᐖゞ)
describe 2 reasons in which state governments have impacted the federal government