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

HURRY PLEASEEEEEEEEEEEEEEEEEEEEEEEEE
Pls help I will give you brainliest! I keep getting bots pls help
calcium + nitrous acid → calcium nitrite + nitrogen monoxide + water
Just need help with number 2 this is missing someone please help me !
Who is the principal antagonist of The Three Musketeers
please help. tap the photo to see the whole problem. thanks. ​
A strand of 10 lights is plugged into a outlet. How can you determine if the lights are connected in series or parrel
Match each shape with its corresponding formula for area. 1. the line which divides a figure into two congruent mirror images rotational symmetry 2. property
Please help me identify this! thank u​
what is the answer?​