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 many nitrogen bases are there in the codon for one amino acid? A 1 B 2 C 3 D 4
info in image (please explain your reason why, so I know your right)
do you think an Electromagnet can be used for separating plastic bags from a garbage heap? explain​
Help me on this please
Given: 3x+12=8x−18 algebraic proofs Step Reason 3x+12=8x−18 12=5x−18 30=5x 6=x x=6
Find the indicated term of the geometric sequence. 10th term of 0.6, 0.06, 0.006,...
Look at image. Art created from blue tiles with a flowering pattern. What art style is this an example of? calligraphy astrolabe arabesque mosaic
5.a.A tourist buys 5 pieces of Nepali cap at Rs 452 per piece including 13% VAT. How much will he recive while leaving Nepal?​
Write the quotient in scientific notation and in standard form. (3.64 x 10000000) (2.6 x 10000)
What is the height, x, of the equilateral triangle shown? 60° 60° 10 in. 60° O A. 5in. O B. OC. 10in. OD. 10√3in. 5√/3in.