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 were popular religious beliefs of midieval Europe different from those at the start of the scientific revolution
How does Aslan reward the children in Chapter 17?
given center C and a point P on a circle, find its equation?
Carbon dioxide enters plants thought the what
What argument does Muir give for protecting the redwoods
Why is atp referred to as "the currency of cellular energy"?
Stephen, whose friends were from out of town, had a great time.Find the adjective clause and copy/paste below.
Galaxies moving away from us will emit light that is redder then we would otherwise expect? true or false
What kind of sentence is "I got interested right away." ? (Complete Sentence, Sentence Fragment, or Run-On Sentence)
What are the rules or standards to observe while working with solutions in a laboratory?