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

Can someone please help me? :(
Why was germany required to pay reparations for ww1.
Even without treatment, depression generally lifts after 6 to 9 months. Group of answer choices True False
how many 2/5 are in 4?
Erika's teammates did not see the point in having a study session with Mr. Kelp. What reason is given explicitly in paragraph 2? (5 points) a They did not like
Why would a pea plant that is heterozygous for plant height have the dominant phenotype?.
Find the perimeter of the figure. O528.75 ft O264.375 ft O 41.25 ft O 82.5 ft
1 Required Solve the problem and explain the steps taken. There are four students working on a project in math class. Miguel has completed 1/8 of the project, G
Who kicked the longest field goal in super bowl history?.
A ______ refers to a child that does not meet age-specific milestones across two or more developmental domains